[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] Checking for numeric datatype
- Subject: RE: [sqr-users] Checking for numeric datatype
- From: "Jim Womeldorf" <jwomeldo@fastenal.com>
- Date: Thu, 31 Aug 2006 11:29:26 -0500
- Delivery-date: Thu, 31 Aug 2006 12:32:00 -0400
- In-reply-to: <DEDF3B78F17BB545A6D5FA266AAE43E2020FBC09@CINMLVEM23.e2k.ad.ge.com>
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
- Thread-index: AcbMXA188dHhZ0HrRQ+xkIaSM0A1FwAvirIA
- Thread-topic: [sqr-users] Checking for numeric datatype
Hi Ram,
I see lots of suggestions for doing this but I think most of them have
flaws in them. I would rather depend upon Oracle's ability to determine
if a string is numeric or not.
Try the following code and see if it would work for your situation.
Jim
begin-program
let $x = '0012'
do isnumeric($x,$yn)
show $x ' ' $yn
let $x = '0012-'
do isnumeric($x,$yn)
show $x ' ' $yn
let $x = '-0.012'
do isnumeric($x,$yn)
show $x ' ' $yn
let $x = '00..12'
do isnumeric($x,$yn)
show $x ' ' $yn
let $x = '001-2'
do isnumeric($x,$yn)
show $x ' ' $yn
let $x = '001a2'
do isnumeric($x,$yn)
show $x ' ' $yn
let $x = '.001.2'
do isnumeric($x,$yn)
show $x ' ' $yn
end-program
begin-procedure IsNumeric($X, :$Result)
begin-select on-error=WOOPS($Result)
DECODE(to_number($X),NULL,'N','Y') &YN
let $Result = &YN
from dual
end-select
end-procedure
begin-procedure WOOPS(:$Result)
let $Result = 'N'
end-procedure
-----Original Message-----
From: sqr-users-bounces+jwomeldo=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+jwomeldo=fastenal.com@sqrug.org] On Behalf Of
Vaidyanathan, Ramakrishnan (GE, Corporate, consultant)
Sent: Wednesday, August 30, 2006 12:45 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] Checking for numeric datatype
Hi,
Is there any function in sqr to check whether the value retireved
from the database field is a numeric or not..some thing like is
numeric..I am retrieving the database field to a variable and I need to
check whether that field is a numeric or not. Pls help Thanks Ram
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users