--测试自定义异常
create or replace package body exception_test_pkg is
exp_difin_error exception;
g_msg_data varchar2(2000);
procedure test(p1 in number, p2 in number) is
begin
if p1 > p2 then
g_msg_data := 'p1大于p2';
raise exp_difin_error;
end if;
end;
procedure main(p1 in number, p2 in number) is
begin
test(p1, p2);
exception
when exp_difin_error then
raise_application_error(-20001, g_msg_data || '; ' || SQLERRM);
END;
end exception_test_pkg;