Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Question? Numeric Functions

Re: Question? Numeric Functions

From: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Tue, 17 Apr 2001 22:37:33 -0700
Message-ID: <3ADD281D.439927F2@exesolutions.com>

One solution is to write your own function such as the following:

CREATE OR REPLACE FUNCTION isnumber(in_value VARCHAR2) RETURN boolean

TestVal NUMBER;

BEGIN
   TestVal := TO_NUMBER(in_value);
   RETURN True;
EXCEPTION
   WHEN INVALID_NUMBER THEN
      RETURN False;
   WHEN OTHERS THEN
      RETURN False;

END; Daniel A. Morgan

Ray Vonhollen wrote:

> Is there any good numeric function available that can check to see if a
> varchar2 or char column contains a pure numeric number? Preferably, a
> function that can be checked by an If Statement without generating a
> PLS-00382 error. It would only execute the preceding Block if statements
> and no execute upon failure.
>
> As an example a column containing the values '102-1' would generate an
> error in using the TO_NUMBER() function, but a column containing the
> values '102.1' would not.
>
> Any help would be greatly appreciated.
>
> Ray-
Received on Wed Apr 18 2001 - 00:37:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US