存储过程记录异常日志的功能

tanglang000 2018-03-07 12:35:26
我的数据库版本是Oracle 11GR2
我有3个业务存储过程sp1,sp2,sp3,1个记录日志的存储过程sp_log。
create or replace procedure sp1 as
begin
sp2;
exception when others then
sp_log;
end sp1;

create or replace procedure sp2 as
begin
sp3;
exception when others then
sp_log;
end sp2;

create or replace procedure sp3 as
n number;
begin
n:='a';
end sp3;

现在我用job跑sp1,sp3这里肯定会报错,那么sp2里面的日志能记到sp3的错误信息,但sp1不会记任何日志啊,就是不会捕捉到sp3的异常,这样我就不知道sp1为何跑失败了。请问各位大佬有没遇到过这种情况,怎么解决的,拜谢!
...全文
976 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
卖水果的net 2018-03-07
  • 打赏
  • 举报
回复
create or replace procedure sp2 as begin sp3; exception when others then sp_log; end sp2; sp2, 把错误都捕捉了,就传不到 sp1 了。 可以考虑在 sp2 这个过程上,加一个成功标记的参数。

17,078

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧