Display error : Error « PL SQL Programming « Oracle PL/SQL Tutorial






SQL>
SQL> set serveroutput on
SQL>
SQL> create or replace procedure proc0 is
  2  begin
  3     RAISE no_data_found;
  4  end;
  5  /

Procedure created.

SQL>
SQL>
SQL> create or replace procedure proc1 is
  2  begin
  3     NULL;
  4     dbms_output.put_line ('calling proc0');
  5     proc0;
  6  EXCEPTION
  7     WHEN OTHERS THEN RAISE DUP_VAL_ON_INDEX;
  8  end;
  9  /

Procedure created.

SQL>
SQL> create or replace procedure proc2 is
  2  begin
  3     dbms_output.put_line ('calling proc1');
  4     proc1;
  5  EXCEPTION
  6     WHEN OTHERS THEN RAISE value_error;
  7  end;
  8  /

Procedure created.

SQL>
SQL>
SQL> create or replace procedure proc3 is
  2  begin
  3     dbms_output.put_line ('calling proc2');
  4     proc2;
  5  end;
  6  /

Procedure created.

SQL>
SQL>
SQL> BEGIN
  2     proc3;
  3  END;
  4  /
calling proc2
calling proc1
calling proc0
BEGIN
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "JAVA2S.PROC2", line 6
ORA-00001: unique constraint (.) violated
ORA-06512: at "JAVA2S.PROC1", line 7
ORA-01403: no data found
ORA-06512: at "JAVA2S.PROC3", line 4
ORA-06512: at line 2


SQL>








24.13.Error
24.13.1.Display error
24.13.2.Get error information: SQLCODE, SQLERRM