SQL>
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL>
SQL> -- Build an anonymous block that will trigger an error.
SQL> DECLARE
2
3
4 my_error EXCEPTION;
5 PRAGMA EXCEPTION_INIT(my_error,-20001);
6
7 BEGIN
8
9 -- Raise the exception.
10 RAISE my_error;
11
12 EXCEPTION
13
14 WHEN my_error THEN
15 dbms_output.put_line('RAISE my_error'||CHR(10)
16 ||'SQLCODE ['||SQLCODE||']'||CHR(10)
17 ||'SQLERRM ['||SQLERRM
18 ||'User defined error.]');
19
20 END;
21 /
RAISE my_error
SQLCODE [-20001]
SQLERRM [ORA-20001: User defined error.]
PL/SQL procedure successfully completed.
SQL>
|