Saturday, October 4, 2008

Display All the Digits in a String (pre 10)

Conn hr/hr

Select Translate(Phone_Number,
' !"#$%&''()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~' ,' ') As
Digits,
Phone_Number
From Employees;
With version 10, you can use Regexp_Replace as shown:
Select Regexp_Replace('abcABC123^&*','[^[:alnum:]]') 
From Dual
SQL> /

REGEXP_RE
---------
abcABC123

No comments:

Post a Comment