1-1. Creating a Block of Code


You are interested in creating an executable block of PL/SQL code.


Write the keywords BEGIN and END. Place your lines of code between those two keywords. Here's an example:

BEGIN    Executable statements go here… END;

If you want to introduce variables for your PL/SQL block, you must precede your block with a DECLARE section. Here's an example:

DECLARE     One or more variable declarations BEGIN     One or more PL/SQL statements END;

How It Works

A block of code is an executable program that performs a unit of work. The minimum executable block of code starts with the keyword BEGIN and ends with the keyword END. In between those two keywords there should be one or more PL/SQL statements that ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.