Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle equivalent of IsNumeric in SQLServer
"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