Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help: a sql question
Different ways to do the same thing ....
You can also do something like this:
SQL> select * from test;
PHONO_NO
SQL> select phono_no from test where
2 replace(translate(translate(phono_no,'*','^'),
'0123456789','**********'),'*') is not null;
PHONO_NO
Effectively making sure that nothing except numbers are there in the column. Though I'd admit that the query does not look pretty :)
Anurag
"Thomas Gaines" <Thomas.Gaines_at_noaa.gov> wrote in message news:3D5C108D.F12143AA_at_noaa.gov...
It's easy. You can easily translate the non-numbers to null and then compare
the length of the original string to the newly translated string. Something like this
would work:
SQL> create table test (phono_no varchar2(20));
Table created.
SQL> insert into test values ('2158983309');
1 row created.
SQL> insert into test values ('301A3458793');
1 row created.
SQL> select * from test;
PHONO_NO
--
Sent by joebayerii from hotmail within area com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com/cgi/content/new
Received on Thu Aug 15 2002 - 19:58:09 CDT
![]() |
![]() |