PL/SQL Blocks

A PL/SQL program is structured using distinct blocks that group related declarations and statements. Each block in a PL/SQL program has a specific task and solves a particular problem. Consequently, you can organize a PL/SQL program so that it is easy to understand.

A PL/SQL block can include three sections, as the following pseudo-code illustrates—program declarations, the main program body, and exception handlers:

DECLARE
-- program declarations are optional
BEGIN
-- program body is required
EXCEPTION
-- exception handlers are optional
END;

Most of the examples in this chapter ask you to use the SQL Command editor that is part of Oracle Application Express to interactively type and execute anonymous PL/SQL blocks while learning ...

Get Hands-On Oracle Database 10g Express Edition for Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.