PL/SQL


PL/SQL stands for Procedural Language/SQL. The following PL/SQL topics will be discussed:
  1. Basic structure of PL/SQL
  2. Variables and types
  3. Simple PL/SQL programs
  4. Control flow in PL/SQL
  1. Cursors
  2. Procedures
  3. Discovering errors
  4. Printing variables
Basic Structure of PL/SQL
The basic unit in PL/SQL is a block. All PL/SQL programs are made up of blocks, which can be nested within each other. Typically, each block performs a logical action in the program. A block has the following structure:
   DECLARE
     /* Declarative section:
        variables, types, and local subprograms. */
   BEGIN
     /* Executable section: 
        procedural and SQL statements go here. */
   EXCEPTION
     /* Exception handling section:
        error handling statements go here. */
   END;
The executable section is required; the other sections are optional.