begin
begin
do something;
exception
when no_data_found then
raise_application_error(-20000,"Message");
end;
exception
when others then
raise_application_error(-20000,"Other message");
end;
我的问题是,当编译器捕获到“消息”错误时,它也捕获了“其他消息”错误。为什么会发生?
尝试将它们放在相同的异常块中。
如果放在when others
一个单独的块中,它将被提高,因为...没有already catched
例外要排除others
在该块之外。
来自文件
WHEN OTHERS子句用于捕获命名系统异常和命名程序员定义异常未处理的所有其余异常。
所以
exception
when no_data_found then
raise_application_error(-20000,"Message");
when others then
raise_application_error(-20000,"Other message");
end;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句