oracle database stored procedures and functions small example

2011-05-10  来源:本站原创  分类:Database  人气:56 

----- Function
create or replace
function isNumber (strNum in varchar2)
return char
is
chkNum number;
begin
chkNum: = to_number (strNum);
return 'Y';
exception
when others
then return 'N';
end isNumber;

declare
ww varchar2 (10): = '17 ';
begin
dbms_output.put_line (isNumber (ww));
end;

----- Procedure
create or replace
procedure isNumber2 (strNum in varchar2)
is
chkNum number;
begin
chkNum: = to_number (strNum);
dbms_output.put_line (chkNum);
exception
when others
then null;
end isNumber2;

call isNumber2 ('13 ');

相关文章