oracle-显示存储过程出错行
从oracle10g开始,通过使用dbms_utility.format_error_backtrace()可以得到存储过程出错的行。示例如下:
SQL> set serveroutput on
SQL> BEGIN
2
3 EXECUTE IMMEDIATE 'wo ca';
4 EXCEPTION
5 WHEN OTHERS THEN
6 dbms_output.put_line('**Error line: '||dbms_utility.format_error_backtrace());
7 dbms_output.put_line('**Error code: '||SQLCODE);
8 dbms_output.put_line('**Error info: '||SQLERRM);
9 END;
10 /
**Error line: ORA-06512: 在 line 3
**Error code: -900
**Error info: ORA-00900: 无效 SQL 语句
PL/SQL procedure successfully completed
SQL>