All Forums Database
Venkatesh G 17 posts Joined 05/09
14 Oct 2014
Remove Chars and get only numeric values

I need to remove all the chars from an alpha numeric string ('AL234ps12;') to get 2342 as the result or
fetch 2342 from the an alpha numeric string ('AL234ps12;').
could anyone give me some idea plz.
Thanks & Regards,
Venkatesh Gubba

Raja_KT 1246 posts Joined 07/09
14 Oct 2014

string ('AL234ps12;') looks like it contains 1 and 1 is numeric. Do you want 1 also like 1234 from the string?
You can use REGEXP_SIMILAR(str,'^[0-9]+$','c')=1

Raja K Thaw
My wiki:
Street Children suffer not by their fault. We can help them if we want.

Venkatesh G 17 posts Joined 05/09
14 Oct 2014

Source column is having a string value like 'AL234ps12w' and i need the output without characters, that is only numeric values 23412 as the output value to be stored in target column.

dnoeth 4628 posts Joined 11/04
14 Oct 2014

There's an old trick utilizing nested oTranslate: remove all characters you want to keep and then use this as characters to be removed:
oTranslate(x, oTranslate(x, '0123456789',''), '')


Venkatesh G 17 posts Joined 05/09
15 Oct 2014

Thanks a lot. :)

You must sign in to leave a comment.