Re: Need Help with SQL Plus in 8i

From: I hate Spam <tbf_at_cn.stam.dk>
Date: Sun, 10 Feb 2002 23:07:55 +0100
Message-ID: <ifrd6usjjm8lak2kpojkflpja2neqkkvu5_at_4ax.com>


On 10 Feb 2002 18:54:15 GMT, sergiugp_at_aol.com (Sergiu gp) wrote:

>Hello guys, I am trying to perform a query on a table where there is a 'phone'
>column that has datatype char. I must convert it into a number and format it as
>follows: '(999) 999-9999' . I can't seem to find a way to do this correctly. I
>am using the command TO_NUMBER(phone, '(999) 999-9999'). I keep getting an
>illegal number format error. Can someone help?
>
An old rule of thump says
"Only use numbers if you have to make calculations!"

Of course - if you want to calculate the average, mean, standard deviation or maybe sum of the phone numbers in your database it could be sensible to have them in numbers.

To convert the strings you will first have to remove all the non-numeric chars from the string, and then use the "to_number" function.

But do you really want that?

Yours Hans Erik Busk
tbf_at_cn.stam.dk Received on Sun Feb 10 2002 - 23:07:55 CET

Original text of this message