[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Q: IsNumeric-function ?
- Subject: Re: Q: IsNumeric-function ?
- From: Andrew Barnett <abarnett@ISD.HIH.COM.AU>
- Date: Wed, 3 Jul 1996 16:44:16 PDT
>We use SQRWB/3.0.7.0.1 in Sun/Solaris & Oracle 7.1 and I
>needed to check in my program if first character in field
>is numeric or not.
>
>At first I tried to look in SQR-functions, but found nothing
>to this purpose. Then I tried to do it in SQL, but couldn't think
>of anything else but ugly decode(substr(field,1,1),1,'YES',2, ....
>
>Does anybody know any way to do this easier in SQR or in Oracle SQL?
<SNIP>
>timo.kytta@vaasa.wartsila.infonet.com
>http://www.pcuf.fi/~tik
>'reality is for people, who cannot ////
> cope with science fiction ' (o o)
> -------------------------------------o00=(_)=00o---
>
in SQR
if isnull(ltrim(rtrim(substr($field,1 ,1 ),'1234567890'), '1234567890'))
do numeric_stuff
else
do other_stuff
end-if
or less good
if substr($field,1,1) in ('1','2' ... etc
do numeric_stuff
else
do other_stuff
end-if
and probably lots of other ways.
Like your sig.
--------------------------------------------------------
Andrew Barnett abarnett@isd.hih.com.au
- Wizzard
--------------------------------------------------------