Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Is_number () like function
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
![]() |
![]() |