Introduction:
Sometimes we need to convert phone numbers stored in alphabetical format into numerical fromat.
Main:
The Translate function in oracle can be used to achieve the same.
for ex,
def PhoneNumber=1-800-TEXAS
Select TRANSLATE(UPPER('&PhoneNumber')
,'ABCDEFGHIJKLMNOPQRSTUVWXYZ)(-','22233344455566677778889999') PHONE from dual;
Output:
*******
PHONE
-----
1-800-83927
def PhoneNumber=1-800-TEXAS Select TRANSLATE(UPPER('&PhoneNumber') ,'ABCDEFGHIJKLMNOPQRSTUVWXYZ)(-','22233344455566677778889999') PHONE from dual; Output: ******* PHONE ----- 1-800-83927 |
Conclusion:
Hope this helps,
Happy Coding.