PL/SQL Error Handling Interview Question and Answers

13. When is an exception propagated to the outside environment?
    An exception is raised within the program and if there is no corresponding exception handler, the PL/SQL block terminates unsuccessfully and the exception is propagated to the calling environment.
14. When is the ROW_TYPE_MISMATCH exception raised?
  • The ROW_TYPE_MISMATCH exception is raised when a host cursor variable and a PL/SQL cursor variable involved in an assignment have incompatible return types.
15. Can the PL/SQL block process more than one exception at a time?
  No, the PL/SQL block cannot handle more than one exception. It can process only one exception handler before terminating.
16. How can a transaction be retried after an exception?
    The following method can be used to retry a transaction after an exception is raised
  • The transaction should be written within a sub-block.
  • The sub-block can be placed inside a loop that repeats the transaction.
  • Mark a save point be before starting the transaction.
  • If the transaction succeeds, then commit and exit from loop. If the transaction fails, the control is transferred to the exception handler where the transaction is rolled back to the save point to undo the changes, and then try to fix the problem.
Page 4 of 6 123 456