Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Statements
 

Raise the exception

SQL> SQL> SET SERVEROUTPUT ON SIZE 1000000 SQL> SQL> -- Build an anonymous block that will trigger an error. SQL> DECLARE   2   3    -- Define local exceptioon variable.   4    my_error          EXCEPTION;   5   6  BEGIN   7   8   9    RAISE my_error;  10  11  EXCEPTION  12  13    WHEN others THEN  14      dbms_output.put_line('RAISE my_error'||CHR(10)  15                           ||'SQLCODE ['||SQLCODE||']'||CHR(10)  16                           ||'SQLERRM ['||SQLERRM||']');  17  18  END;  19  / RAISE my_error SQLCODE [1] SQLERRM [User-Defined Exception] PL/SQL procedure successfully completed. SQL>