Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 25 Apr 2008 @ 10:02:29 GMT


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


Subj:   Re: Extract values from field
 
From:   Jinesh P V

I think udf will be best solution. But if you are going with recursive option, try this. [i am using Michael's table/column names]

     with recursive num_found (num,vartext, lvl) as
     (
     select  ''(varchar(2000))  as num, vartext, 1 as lvl  from vartable
     union all
     select num||case when substr(vartext,lvl,1) between '0' and
     '9'  then substr(vartext,lvl,1) else '' end
            , vartext
            , lvl+1
     from num_found
     where lvl <= character_length(vartext)
     )
     select *
     from num_found
     qualify row_number() over (partition by vartext order by lvl
     desc) = 1;

thanks,

Jinesh P V



     
  <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