Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Simple problem...
"Telemachus" <tollg_at_tendwa.rns.net> wrote in
news:Asr7a.12231$V6.16492_at_news.indigo.ie:
> Thanks Andrew... > > I just wondered if there was another way than 6502 > "Andrew Allen" <andrew.allen_at_handleman.com> wrote in message > news:3E5E3A82.8020605_at_handleman.com...
> or>> > i.e. given a string return true if the string represents a valid
>> > is_an_integer()
>> >
>> >
> or
>>
Hello,
You can do it without exceptions if you use translate to remove all the numeric characters and check for null. See this example below. Note the 'x' is just a dummy translation to itself so that transalate won't always return null.
SQL> select * from t;
STRING
10 rows selected.
SQL> select to_number(string)
2 from t where
3 translate(string,'x0123456789','x') is null;
TO_NUMBER(STRING)
12345 987 999 953
SQL> select to_number(string)
2 from t where
3 translate(string,'x.0123456789','x') is null;
TO_NUMBER(STRING)
12345 987 987.01 999 953
Also see this link for a longer example, URL may wrap.
http://groups.google.com/groups?&selm=Xns927AD545426D9pobox002bebubcom% 40216.148.227.77
Hth
Martin
Received on Thu Feb 27 2003 - 19:03:20 CST