Functions for error trapping are contained in which section of a PL/SQL block?
-
Header
-
Declarative
-
Executable
-
Exception
Error trapping uses EXCEPTION handlers within the EXCEPTION section of a PL/SQL block. The EXECUTABLE section contains the runtime code that may raise exceptions. The EXCEPTION section is where handlers are defined. Header has no error handling. Declarative defines variables/types.
To answer this question, we need to understand the structure of a PL/SQL block.
A PL/SQL block is divided into three sections:
Header: This section is optional and is used to declare the name and parameters of the PL/SQL block.
Declarative: This section is also optional and is used to declare variables, cursors, types, and other program objects that are used within the block.
Executable: This section contains the actual executable code of the PL/SQL block.
The correct answer is:
C. Executable: The executable section is where the main code logic of the PL/SQL block is written. It contains statements and control structures that are executed sequentially.
D. Exception: The exception section is used to handle and trap errors that may occur during the execution of the PL/SQL block. It contains error-handling code that is executed when an exception is raised.
Therefore, the functions for error trapping are contained in the executable and exception sections of a PL/SQL block.