pl/sql非预定义异常之ORA-02292小例子

delete from dept where deptno = 10; delete from dept where deptno = 10 * ERROR at line 1: ORA-02292: integrity constraint (SCOTT.FK_DEPTNO) violated - child record found SQL> declare 2 e_deptid exception; --定义异常 3 pragma exception_init(e_deptid,-2292); --将异常和错误号关联 4 begin 5 delete from dept where deptno = 10; 6 exception 7 when e_deptid then --捕获异常 8 dbms_output.put_line('There is record at sub table'); 9 end; 10 / There is record at sub table PL/SQL procedure successfully completed.


你可能感兴趣的:(pl/sql非预定义异常之ORA-02292小例子)