Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / PL SQL Programming
 

Assign custom exception a number

SQL> SQL> DECLARE   2     bad_date EXCEPTION;   3     PRAGMA EXCEPTION_INIT (bad_date, -1843);   4  BEGIN   5     DBMS_OUTPUT.PUT_LINE (TO_DATE ('13/13/99', 'MM/DD/YY'));   6  EXCEPTION   7    WHEN bad_date   8    THEN   9      DBMS_OUTPUT.PUT_LINE('Just twelve months in a year...');  10  END;  11  / Just twelve months in a year... PL/SQL procedure successfully completed.