Raising a dynamic exception without previously declaring a user-defined EXCEPTION variable: : Exception Range « PL SQL « Oracle PL / SQL






Raising a dynamic exception without previously declaring a user-defined EXCEPTION variable:

   
SQL>
SQL> BEGIN
  2    RAISE_APPLICATION_ERROR(-20001,'A not too original message.');
  3  EXCEPTION
  4    WHEN others THEN
  5      dbms_output.put_line(SQLERRM);
  6  END;
  7  /
ORA-20001: A not too original message.

PL/SQL procedure successfully completed.

   
    
    
  








Related examples in the same category

1.Inner exception and outter exception
2.Exception Range in action
3.Add a WHEN OTHERS handler to catch all runtime exceptions.
4.A WHEN OTHERS handler that records which runtime error occurred.