Make Oracle do the work.
HTH
Jared
create or replace function is_number( chk_data_in varchar2 )
return boolean
is
dummy number(38,4);
begin
dummy := to_number(chk_data_in);
return true;
exception
when value_error then
return false;
when others then
raise;
end;
/
show errors function is_number
declare
v_test varchar2(10) := '1E';
begin
if is_number(v_test) then
dbms_output.put_line(v_test || ' is a number');
else
dbms_output.put_line(v_test || ' is NOT a number');
end if;
end;
/
Hamid Alavi <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
07/18/2002 09:58 AM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
cc:
Subject: Function
Hi List,
Is there any way that I can check to see if the value in a variable is a
number?
Example:
is_number('100') = TRUE
is_number('ABC') = FALSE
Hamid Alavi
Office 818 737-0526
Cell 818 402-1987
======================= Confidentiality Statement =======================
The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed, and may contain information that is PRIVILEGED, CONFIDENTIAL
and exempt from disclosure under applicable law. If you have received
this message in error, you are prohibited from copying, distributing, or
using the information. Please contact the sender immediately by return
e-mail and delete the original message from your system.
===================== End Confidentiality Statement =====================
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Hamid Alavi
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).