December 2002
Intermediate to advanced
928 pages
85h 29m
English
Each PL/SQL program is a block consisting of a standard set of elements, identified by keywords The block determines the scope of declared elements and controls how exceptions are handled and propagated.
The block structure has the following syntax:
[CREATE OR REPLACEname[(parameterdatatype[,parameterdatatype. . .]) {IS | AS}] -- Header section [[DECLARE]variablevariable_type; [variablevariable_type; . . .] -- Declaration section BEGINexecution_code; [execution_code; . . ] END; -- Execution section [EXCEPTIONexception_code; [exception_code; . . ] ] -- Exception section
The sections are:
Provides the name of the block. Required for named blocks and not allowed for anonymous blocks.
Declares variables, constants, cursors, TYPEs, and local programs used in the block. Optional.
Contains execution code. Generally used, but optional in package and TYPE specifications.
Handles error conditions. Optional.
Descriptions of these four sections of code and their main characteristics follow.