Main Page | See live article | Alphabetical index

PL SQL

PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's proprietary extension of the SQL database language.

Since SQL is a declarative language, and unlike some functional programming languages the standard does not require implementations to convert tail calls to jumps or readily provide "first row" and "rest of table" accessors, SQL cannot easily perform some constructs such as loops. PL/SQL, however, is a Turing-complete procedural language which fills in these gaps, allowing Oracle database developers to interface with the underlying relational database in an imperative manner. SQL queries call PL/SQL functions through constructions such as triggers.

PL/SQL is analogous to the embedded procedural languages for other relational databases. Sybase and its derivative Microsoft SQL Server have Transact-SQL, PostgreSQL has PL/pgSQL (which tries to emulate PL/SQL to an extent), and Oracle can also use methods written in Java. Aside from some proprietary functions (notably Oracle's UTL_FILE package) PL/SQL code is nearly identical to Transact-SQL; conversions are simple if no proprietary features are used.

References