Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format phone number???? (608) 276-9201 1

Status
Not open for further replies.

japfel

Technical User
Dec 16, 2002
1
US
How do I format a phone number from 6082769201 to (608) 276-9201 ?
Thanks for your help!
 
Try this

Case
when c.voice_phone_nbr <> '' Then '(' ||
substring (c.voice_phone_nbr from 1 for 3) || ') '
|| substring (c.voice_phone_nbr from 4 for 3) || '-'
|| substring (c.voice_phone_nbr from 7 for 4)
End as PHONE_NUMBER

QueryMan

 
By the way, I strongly urge you to store the area code and the phone number is seperate columms. if you should ever have occasion to fax using your stored phone numbers, it is a lot easier if you can test your area code and exchange seperately.

if area_code <> '801' then
if phone_number not like '778%'
call = phone_number
else
call = '1'||phone_number
end
else
call = '1'||area_code||phone_number
end I tried to remain child-like, all I acheived was childish.
 
jimbo is on the right track - but add the country code too! Otherwise you have just switched youself out of the export market!
DaPi - no silver bullet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top