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: SQL Function

Re: SQL Function

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Tue, 30 Apr 2002 22:11:10 GMT
Message-ID: <3CCF167C.C4DE1F33@exesolutions.com>


Ken Denny wrote:

> "Prasad Yarlagadda" <prasad.yarlagadda_at_motorola.com> wrote in
> news:aajlft$b8u$1_at_localhost.localdomain:
>
> > Is there any standard SQL function available to check whether an array
> > of characters is a String or a Number? I am looking for something like
> > IS_NUMBER or IS_CHARACTER. I don't want to write a function for it if
> > oracle has already provided.
> >
> > TIA,
> > Prasad
> >
> >
>
> Lots of replies but none with the solution to your problem, so try this:
>
> FUNCTION is_number (numstring VARCHAR2) RETURN BOOLEAN
> IS
> /*
> || Returns true if the string contains a valid number
> */
> w_num NUMBER;
> BEGIN
> w_num := TO_NUMBER(numstring);
> RETURN TRUE;
> EXCEPTION
> WHEN INVALID_NUMBER OR VALUE_ERROR THEN
> RETURN FALSE;
> END is_number;
>
> --
> Ken Denny (PL/SQL guru in search of employment)
> http://www.kendenny.com/
>
> Planting vegetables is a great money-saver. Over the course of a summer,
> you could shave $75 off your grocery bill with just a few hundred hours of
> work.

I don't know what you've been looking at. This block (esentially) was posted several days ago.

Daniel Morgan Received on Tue Apr 30 2002 - 17:11:10 CDT

Original text of this message

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