Procedural Language extension of SQL (PL/SQL) combines SQL with procedural programming features such as looping, conditionals, and reusable blocks. PL/SQL engine processes PL/SQL statements. PL/SQL statements can reside on the client on server.

PL/SQL Blocks

PL/SQL blocks are made up of PL/SQL and SQL statements. A block is a functional unit made up of an optional declaration section, an execution section, and an optional exception or error handling section. A block has the following syntax

  variable declaration
  Program Execution
  Exception handling

PL/SQL constants, variables, and records

PL/SQL variables have type and scope. The have the following syntax:

name datatype [NOT NULL := value];

not null and value are optional. All statements end with a semicolon (;).

Setting up environment to run PL/SQL

This sections shows how to setup an environment to setup and run PL/SQL. For PL/SQL, you need to download two pieces of software freely available from Oracle.

First, download Oracle Express Edition. It is a lighter version of Oracle, good enough for non-enterprise level work. In addition, it is a much smaller download.

  1. Download Oracle Express Edition
  2. Unzip
  3. Double-click on setup.exe
  4. Follow instructions. It will ask you for a password. Write this password or memorize it.

When installation is complete, start the software. You will be prompted for a username and password.

Your username is SYS Your password is whatever you typed during installation

Next, download and installsqldeveloper.

  1. Download sqldeveloper
  2. Unzip
  3. Double-click to install