Raise the exception. : RAISE « PL SQL Statements « Oracle PL/SQL Tutorial






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>
SQL>








22.24.RAISE
22.24.1.Check condition first, then raise exception
22.24.2.Re-raise the exception to indicate there is a problem
22.24.3.Raise the exception.
22.24.4.Define local exceptioon variable.