Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Format phone number
it would be problem if the number more or less then ten, i think it is a static query.
-- --------- Original Message --------- DATE: Wed, 14 May 2003 11:46:50 To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Cc:Received on Fri May 16 2003 - 13:21:56 CDT
>Bob - Would something like the following work for you?
>
>SQL> create table test (field1 number(10));
>
>Table created.
>
>SQL> insert into test values (2129779898);
>
>1 row created.
>
>SQL> commit;
>
>Commit complete.
>
> 1 select '('||substr(field1,1,3)||')'||substr(field1,4,3)||
> 2* '-'||substr(field1,7,4) from test
>
>'('||SUBSTR(F
>-------------
>(212)977-9898
>
>Dennis Williams
>DBA, 80%OCP, 100% DBA
>Lifetouch, Inc.
>dwilliams_at_lifetouch.com
>
>
>-----Original Message-----
>Sent: Wednesday, May 14, 2003 11:22 AM
>To: Multiple recipients of list ORACLE-L
>
>
>All
>
> Say I have a phone number char column with a length of 10 phone
># is 2129779898
>
>I want to create a view with the number displayed (212)977-9898
>
>Something like
>
>select to_char(phone_number, '(999)999-9999') from phone_numbers;
>ORA-01481: invalid number format model
>
>But obiviously the to_char donst behave as a universial formatting /
>mask function.
>The function seems to, to_char only dates and currency
>
>I've searched google and orafaq but nothing jumped out.
>
>I know someone on this list has the answer...
>
>Thanks!
>bob
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>--
>Author: Bob Metelsky
> INET: bmetelsky_at_cps92.com
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>--
>Author: DENNIS WILLIAMS
> INET: DWILLIAMS_at_LIFETOUCH.COM
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
>
>
____________________________________________________________ Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! http://login.mail.lycos.com/r/referral?aid=27005 -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: zions swordfish INET: zettira_at_lycos.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).