|
|
Archives of the TeradataForum
Message Posted: Fri, 25 Apr 2008 @ 10:02:29 GMT
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
| |