Assign custom exception a number : Your Exception « PL SQL Programming « Oracle PL/SQL Tutorial






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.








24.18.Your Exception
24.18.1.Create your own no_data_found EXCEPTION
24.18.2.An example showing handling of pre-defined exceptions
24.18.3.Catch 'cannot get lock exception'
24.18.4.Handling user-defined exceptions with a WHEN clause
24.18.5.An example of using PRAGMA EXCEPTION_INIT
24.18.6.Assign custom exception a number