Google News
logo
PL/SQL - Interview Questions
How can a name be assigned to an unnamed PL/SQL Exception Block?
* This can be done by using Pragma called EXCEPTION_INIT.

* This gives the flexibility to the programmer to instruct the compiler to provide custom error messages based on the business logic by overriding the pre-defined messages during the compilation time.

Syntax :
DECLARE 
  exception_name EXCEPTION; 
  PRAGMA EXCEPTION_INIT (exception_name, error_code); 
BEGIN 
// PL/SQL Logic
EXCEPTION
 WHEN exception_name THEN
    // Steps to handle exception
END;
Advertisement