Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 10 Sep 2003 @ 13:25:17 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: IS_NUMBER
 
From:   Geoffrey Rommel

  is_number('ABC') -> returns FALSE
is_number('123') -> returns TRUE
 


  Any idea about how to implement something similar with Teradata?  



Some day we will have user-defined functions (planned for V2R5.1, I believe). Until then, you'll have to use a case expression -- something like this:

case
 when substr(mystery_column, 1,1) between '0' and '9'
  and substr(mystery_column, 2,1) between '0' and '9'
  and substr(mystery_column, 3,1) between '0' and '9'
  ...and so on...  then 1
 else 0
end  as is_numeric

Of course, if your columns can contain leading blanks or decimal points or 'E' for exponential notation, your case expression will have to be more complex. It could get ugly!



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023