PL/SQL Error Handling Interview Question and Answers

9. What is the advantage of having a separate exception section within a PL/SQL code?
 
    The advantages of having a separate exception section within a PL/SQL code are as follows:
  • It is easier to understand the program logic as it is easily visible and readable.
  • Any error in any statement will be detected and handled easily.
10. What is the difference between user defined exceptions and Oracle defined exceptions?
 
  • User-defined exceptions are explicitly raised; whereas, oracle-defined exceptions are raised implicitly.
11. Describe the OTHERS exception handler?
 
  • The exception section handles only those errors that are specified; however, other errors that are not specified cannot be handled.
  • To handle these errors explicitly, the OTHERS exception handler is used that is always defined as the last exception handler.
12. What is the difference between RAISE and RAISE_APPLICATION_ERROR?
 
  • RAISE is used to call pre-defined exceptions declared in the declarative section of the PL/SQL block.
  • RAISE_APPLICATION_ERROR is used to call user-defined ORA – error messages from stored subprograms.
Page 3 of 6 12 3456