Multiple choice technology databases

How do you handle an Exception?

  1. Trap it with a Handler

  2. Propagate it to the Calling Environment

  3. a & then b

  4. b & then a

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Exception handling in PL/SQL follows a two-phase process: first trap the exception with an exception handler (WHEN clause in the EXCEPTION block), then optionally propagate it to the calling environment if the handler cannot fully resolve it. Option C ('a & then b') correctly captures this sequence - handle first, propagate if needed. Option A is incomplete because trapping alone doesn't complete the handling. Option B is incorrect as the first step must always be handling. Option D reverses the correct order - you cannot propagate before trapping.

AI explanation

Exceptions are typically handled either by trapping them locally with a handler (so the exception is caught and dealt with right there) or by letting them propagate up to the calling environment if the current block doesn't handle them. Since both mechanisms are valid, standard ways of dealing with an exception, the combined answer captures the full picture rather than just one half.