Setting the message dynamically : Raise « PL SQL « Oracle PL / SQL






Setting the message dynamically

    

SQL>
SQL> DECLARE
  2     e EXCEPTION;
  3    PRAGMA EXCEPTION_INIT(e,-20001);
  4  BEGIN
  5    RAISE_APPLICATION_ERROR(-20001,'A less than original message.');
  6  EXCEPTION
  7    WHEN e THEN
  8      dbms_output.put_line(SQLERRM);
  9  END;
 10  /
ORA-20001: A less than original message.

PL/SQL procedure successfully completed.

SQL>

   
    
    
    
  








Related examples in the same category

1.Raise your own exception
2.Raising an exception
3.Raising NO_DATA_FOUND Exception
4.RAISE_APPLICATION_ERROR
5.Raise different exception depends on value input
6.Raise exceptions for wrong parameters
7.Print out an error message
8.Raises and manages a standard anonymous block PL/SQL program error.
9.This procedure demonstrates the use of RAISE_APPLICATION_ERROR.