PL/SQL Error Handling Interview Question and Answers

1. What are the different types of exceptions?
 
    The three types of exceptions that can be handled at runtime are as follows
  • Predefined Oracle error – Refers to an undeclared error, which is raised by the Oracle server implicitly.
  • Non predefined Oracle error – Refers to an error declared in the declarative section of the code that is raised by the Oracle server implicitly.
  • User defined error – Refers to an error declared in the declarative section of the code that is raised explicitly.
2. What is an exception?
 
  • An exception is an identifier, which defines an error condition within the Procedural Language/Structured Query Language (PL/SQL) code.
  • When an error occurs, it is trapped and the program control unconditionally branches to the exception section of the PL/SQL block.
3. What is the advantage of OTHERS exception handler?
  The OTHERS exception handler ensures that no exception goes unhandled and the program terminates successfully.
4. What is the meaning of PRAGMA keyword?
 
  • The PRAGMA keyword signifies that the statement is a compiler directive, which is not processed when the PL/SQL is executed.
  • It is a pseudo-instruction that tells the compiler to interpret all the occurrences of exception name within the block with the associated Oracle server number.
Page 1 of 6 123456