Oracle Database 11g: Program with PL/SQL — Question 43
Which two statements are true about the handling of internally defined or user-defined PL/SQL exceptions? (Choose two.)
Answer options
- A. Add exception handlers whenever errors occur.
- B. An exception handler should commit the transaction.
- C. Handle named exceptions whenever possible instead of using when others in exception handlers.
- D. Instead of adding exception handlers to your PL/SQL block, check for errors at every point where they may occur.
Correct answer: A, C
Explanation
The correct answers are A and C because adding exception handlers is crucial for managing errors properly, and using named exceptions provides clearer error handling than the generic 'when others' statement. Options B and D are incorrect as committing a transaction in an exception handler can lead to inconsistent data states, and checking for errors at every point can clutter code and is not a standard practice in PL/SQL exception handling.