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: Oracle equivalent of IsNumeric in SQLServer

Re: Oracle equivalent of IsNumeric in SQLServer

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Fri, 30 Aug 2002 10:05:31 +0100
Message-ID: <3d6f355b$0$236$ed9e5944@reading.news.pipex.net>


"tojo" <TomJordanTojo_at_hotmail.com> wrote in message news:MPG.17d8662d1e97de59896b2_at_news.t-online.de...
> > Is there a similar function in Oracle SQL?
> >
> You can write your own PL/SQL function, something like:
>
> FUNCTION IS_NUMBER
> (
> p_str IN VARCHAR2
> )
> RETURN NUMBER IS
> v_dummy NUMBER;
> BEGIN
> v_dummy := TO_NUMBER(p_str);
> RETURN -1;
> EXCEPTION
> WHEN OTHERS THEN
> -- TO_NUMBER function above didn't work out
> RETURN 0;
> END;
This is the correct way to go, but be careful to test correctly (for example is NULL a number?)

--
Niall Litchfield
Oracle DBA
Audit Commission UK
*****************************************
Please include version and platform
and SQL where applicable
It makes life easier and increases the
likelihood of a good answer

******************************************
Received on Fri Aug 30 2002 - 04:05:31 CDT

Original text of this message

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