当前位置: 代码迷 >> SQL >> oracle pl/sql 错误处理
  详细解决方案

oracle pl/sql 错误处理

热度:89   发布时间:2016-05-05 15:11:19.0
oracle pl/sql 异常处理
declare
bengin

--------业务sql
--------发生异常捕获的地方
exception
   when others then
      DBMS_OUTPUT.put_line('sqlcode : ' || sqlcode);
      DBMS_OUTPUT.put_line('sqlerrm : ' || sqlerrm);
      rollback ;
      --debug日志记录
      str_l_errlog := 'error sqlcode : ' || sqlcode || ' sqlerrm :'||substr(sqlerrm,1,3500);
      if(str_l_debug = 'true') then
          insert into t_errorSql(sqltext) values(str_l_errlog);
      end if;
      commit;
end;
/
  相关解决方案