Multiple choice technology databases

Functions for error trapping are contained in which section of a PL/SQL block?

  1. Header

  2. Declarative

  3. Exception

  4. Executable

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

The Exception section of a PL/SQL block contains error trapping and handling logic. When an error occurs in the Executable section, control transfers to the Exception section where you can catch specific exceptions (like NO_DATA_FOUND) or use WHEN OTHERS for a catch-all handler. The Declarative section declares variables, and the Header section contains the block name and parameters.

AI explanation

The Exception section of a PL/SQL block is specifically where error-handling logic lives — it's where you write handlers (WHEN ... THEN) that catch and respond to runtime errors raised during the Executable section. The Declarative section only defines variables/cursors, and the Executable section contains the main logic that might raise the errors, but doesn't trap them.