Home » RDBMS Server » Server Administration » Translate
Translate [message #373527] Fri, 20 April 2001 15:05 Go to next message
VGU
Messages: 1
Registered: April 2001
Junior Member
Hi,
I am trying to translate a format (i.e)
from 999/999-9999 to 9999999999.
I could do this by using 'replace' twice
select replace(replace('999/999-9999','-'),'/') phone from dual.
Is there any other way without repeating the function twice?
All the help will be appreciated.
Thanks,
VGU
Re: Translate [message #373536 is a reply to message #373527] Sun, 22 April 2001 20:13 Go to previous messageGo to next message
Joseph Stiehm
Messages: 4
Registered: April 2001
Junior Member
try

select translate('999/999-9999','a-/','a') phone from dual

the first replacement is a dummy...the character 'a' in this case should never show up in your original string...every character after will be eliminated.

Joseph Stiehm
Re: Translate [message #373537 is a reply to message #373527] Sun, 22 April 2001 20:46 Go to previous messageGo to next message
Joseph Stiehm
Messages: 4
Registered: April 2001
Junior Member
actually it doesn't matter whether the character 'a' shows up in the original string or not
Re: Translate [message #373546 is a reply to message #373527] Mon, 23 April 2001 07:40 Go to previous message
Joseph Stiehm
Messages: 4
Registered: April 2001
Junior Member
Thanks,Joseph.
Previous Topic: star schema to denormalized table
Next Topic: Query a column and remove everything after the space
Goto Forum:
  


Current Time: Sat Jun 29 00:11:35 CDT 2024