Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 17 Jun 2004 @ 21:15:59 GMT


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


Subj:   Re: How to identify number in alphanumerics field?
 
From:   Hartman, David L

One way to do this is to use CASE and SUBSTR logic as shown below to check each byte for numerics (up to the max size of the VARCHAR column)and TRIM to eliminate blanks.

     select
     (trim((case when (substr(COLUMN,1,1)   between '0' and '9')
           then substr(COLUMN,1,1)
           else ' '
           end) ||
     (case when (substr(COLUMN,2,1)    between '0' and '9')
           then substr(COLUMN,2,1)
           else  ' '
           end))) ||
     (trim((case when (substr(COLUMN,3,1)   between '0' and '9')
           then substr(COLUMN,3,1)
           else ' '
           end) ||
     (case when (substr(COLUMN,4,1)    between '0' and '9')
           then substr(COLUMN,4,1)
           else  ' '
           end))) ||
     ..


     
  <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: 27 Dec 2016