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: Mon, 29 Apr 2002 21:45:48 GMT
Message-ID: <3CCDBF0C.D03DF769@exesolutions.com>


Richard Kuhler wrote:

> I think it will give an error if the data isn't a number (unlike the
> pl/sql function Daniel gave you).
>
> Richard
>
> Prasad Yarlagadda wrote:
> >
> > Thanks Daniel for that info.
> >
> > I was really looking to avoid doing this in a PL/SQL block. What do you
> > think about using
> >
> > if mod(number, number) = 0 then it is a number?
> >
> > Thanks
> > Prasad
> >
> > "Daniel Morgan" <dmorgan_at_exesolutions.com> wrote in message
> > news:3CCD7138.5FEF4BF5_at_exesolutions.com...
> > > Prasad Yarlagadda wrote:
> > >
> > > > 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
> > >
> > > No. This must be done in a PL/SQL block such as the following:
> > >
> > > BEGIN
> > > test := TO_NUMBER(somevalue);
> > > <do something>
> > > EXCEPTION
> > > WHEN OTHERS THEN
> > > <do something else>
> > > END;
> > >
> > > If you don't do it this way you need to be very careful about what you
> > decide is
> > > a number. For example ... is 8.1.7.3 a number? It would be with a lot of
> > code
> > > I've seen written.
> > >
> > > Daniel Morgan
> > >

What can you try to cast with TO_NUMBER that isn't and won't cause it to fail?

Daniel Morgan Received on Mon Apr 29 2002 - 16:45:48 CDT

Original text of this message

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