Raise User-defined exceptions
SQL>
SQL>
SQL>
SQL> DECLARE
2 myException EXCEPTION;
3 BEGIN
4
5 RAISE myException;
6
7 DBMS_OUTPUT.PUT_LINE('This enrollment has been deleted');
8 EXCEPTION
9
10 WHEN myException THEN
11 DBMS_OUTPUT.PUT_LINE('This enrollment is already confirmed');
12 DBMS_OUTPUT.PUT_LINE('It cannot be deleted');
13 END;
14
15 /
This enrollment is already confirmed
It cannot be deleted
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category