use*_*855 18 oracle plsql exception-handling
我有一些应用程序使用的以下过程:
procedure p1
is
begin
bla bla bla;
end;
Run Code Online (Sandbox Code Playgroud)
但是没有异常处理块.因此应用程序是根据此功能编写的.
现在我需要在p1中记录错误.但它不应该影响使用此过程的应用程序.
像这样的东西:
procedure p1
is
begin
bla bla bla;
exception when others then
log_error(sqlcode, sqlerrm);
raise_new_exception (sqlcode, sqlerrm);
end;
Run Code Online (Sandbox Code Playgroud)
在raise_application_error的情况下,第一个参数应该在[-20000,-20999]范围内.因此,如果引发异常no_data_found,则无法引发此错误.
在exception_init的情况下,第二个参数不应该是变量.它必须是数字文字.
PS:作为临时解决方案,我正在使用execute immediate
igr*_*igr 29
如果您的错误保持不变,请更改为
...
exception when others then
log_error(sqlcode, sqlerrm);
raise;
end;
/
Run Code Online (Sandbox Code Playgroud)
这在文档中有解释.