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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Is_number () like function

Re: Is_number () like function

From: Tommy Wareing <p0070621_at_brookes.ac.uk>
Date: Wed, 22 Jul 1998 08:51:02 GMT
Message-ID: <35b5a676.1814942449@news.brookes.ac.uk>


On Tue, 21 Jul 1998 17:42:16 +0200, "Christophe Renard" <crenard_at_mednet.mc> wrote:

>Thanx to you and all the other that aswered me.
>But what I am willing to check isn't only if the string contains good
>characters but if its a valid number.

My inclination would be:
CREATE OR REPLACE
FUNCTION is_number(a IN VARCHAR2) RETURN BOOLEAN IS   b NUMBER;
BEGIN
  b:=TO_NUMBER(a);
  RETURN TRUE;
EXCEPTION
WHEN INVALID_NUMBER THEN RETURN FALSE;
END; I'm not sure you can use boolean functions in queries... if you can't, then just change it to some other type, such as VARCHAR, and return two distinct values such as Y and N.

--
Tommy Wareing
MIS Group
Learning Resources
Oxford Brookes University
01865 483389 Received on Wed Jul 22 1998 - 03:51:02 CDT

Original text of this message

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