CRITICAL SKILL 6.2

Describe the Basic PL/SQL Program Structure

The structure we use in PL/SQL is the foundation for all of the language. Once you’ve mastered it, you will then be able to move forward; however, if you do not take the time to get this first step right, your journey will be difficult. Thankfully, it’s quite simple.

The structure is quite basic. You will have areas for your program parameters (these are used to pass values from outside a program to the program itself), your internal variables, the main program code and logic, and various ways to deal with problem situations. Let’s look at the basic form of a PL/SQL block:

 [DECLARE]
    -- Put Variables Here
BEGIN
    -- Put Program Here
[EXCEPTION]
    -- Put exception handlers here
END;

Get Oracle Database 10g: A Beginner's Guide 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.