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

Home -> Community -> Usenet -> c.d.o.server -> Re: Numeric Function

Re: Numeric Function

From: MarkyG <markg_at_mymail.tm>
Date: 8 Nov 2001 02:09:34 -0800
Message-ID: <ab87195e.0111080209.615da74a@posting.google.com>


The suggestions so far are fine but...

what about a number like 7.3?

You may want to include a decimal point in the translate list.

Try this. If you dont care about decimals, remove it from the translate list.

   FUNCTION Is_Numeric(in_value IN varchar2) RETURN boolean is

      v_retval boolean;
   BEGIN

      IF REPLACE(TRANSLATE(in_value,'0123456789.',' '),' ','') IS NULL THEN
         v_retval := TRUE;
      ELSE
         v_retval := FALSE;
      END IF;

      RETURN v_retval;

   END Is_Numeric;

Mark

Richard Kuhler <noone_at_nowhere.com> wrote in message news:<%yjG7.20674$D5.8286434_at_typhoon.san.rr.com>...
> Connor McDonald wrote:
> >
> > NeedaHoliday wrote:
> > >
> > > Is there a function or method to search a string character and find
> > > only numeric values?
> > >
> > > Thanks
> >
> > where
> > replace(
> > translate(col,'0123456789','9999999999')
> > '9',null) is null
> >
> > or thereabouts
> >
>
> or more efficiently....
>
> where translate(col, ' 0123456789', ' ') is null
>
>
> Richard
Received on Thu Nov 08 2001 - 04:09:34 CST

Original text of this message

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