Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle equivalent of IsNumeric in SQLServer
In article <f724a6c4.0208290711.641f9a45_at_posting.google.com>, c266366430
@hotmail.com says...
> Dear folks,
>
> In Transact-SQL (SQLServer 7/2000), there's a function called
> IsNumeric to determine whether an expression is a valid numeric type
> or not.
>
> For instance, "SELECT ISNUMERIC("No Number")" will return 0 (false),
> and "SELECT ISNUMERIC(123)" or "SELECT ISNUMERIC("123")" will return 1
> (true).
>
> 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