Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Trimming Inner Spaces - response (6) by mohan.mscss

$
0
0
Here is with recursive function.... Just change this 1234567890 as what we need to replace in a string with recursive r2(id, st, L, c, rstr) as ( sel id,str as st, char(st) as L, 1 as c, trim(case when position(substr(st,1,1) in '1234567890') > 0 then ''else substr(st,1,1) end) as rstr from revString union all sel r2.id,r2.st, char(st) as L, c+1 as c, rstr || trim(case when position(substr(r2.st,c+1,1) in '1234567890') > 0 then ''else substr(r2.st,c+1,1) end) as rstr from  r2 where L <> c )sel * from r2 order by id,4 desc ;  

Viewing all articles
Browse latest Browse all 27759

Trending Articles