[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Q: IsNumeric-function ?



At 09:17 AM 7/3/96 GMT-0200, you wrote:
>Hello everybody!
>
>I joined in this list yesterday and now I already have a
>good (?) question.
>
>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?
>
>
>Thanks in advance
>                   Timo
>
>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---
>
>

Here's one way you could do it

if range(substr(&field,1,1),'0','9')
        print 'Numeric'
else
        print 'Not Numeric'
end-if

Mark