Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error in IS_NUMBER Function PL/SQL!!

Guru SankarApr 10 2009 — edited Apr 10 2009
Hi Experts,

I have a pl/sql function for checking the input is numeber or not and it needs to retrun BOOLEAN value. Here is the code for that,

CREATE OR REPLACE function is_number(in_var in varchar2)
return BOOLEAN
is
v_number number;
begin
if in_var IS NOT NULL THEN
v_number := to_number(in_var);
return TRUE; -- No exception, so is a number
else
return FALSE;
end if;
exception
when others then
RAISE;
end;


When i run the above function,

select is_number('1') from dual;

Its errored out saying,

ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type

Please let me know where i am wrong.

Thanks,
G
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 8 2009
Added on Apr 10 2009
5 comments
958 views