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

How to exceute only integer records in character column - response (2) by dnoeth

$
0
0
Of course the best approach is a UDF. If oTranslate is installed this is an old trick to get rid of any unwanted chars: oTranslate(a, '.' || oTranslate(a, '.0123456789', '.'), '.') When your version of oTranslate is not considering empty strings as NULL (stupid Oracle) it's easier: oTranslate(a, oTranslate(a, '0123456789', ''), '')   Without UDFs you could avoid recursion, too: case when substring(a from 1 for 1) between '0' and '9' then substring(a from 1 for 1) else '' end || case when substring(a from 2 for 1) between '0' and '9' then substring(a from 2 for 1) else '' end || case when substring(a from 3 for 1) between '0' and '9' then substring(a from 3 for 1) else '' end || ... Of course this assumes column a has a short length. Dieter  

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>