PL/pgSQL
From Wikipedia, the free encyclopedia
PL/pgSQL (Procedural Language/PostgreSQL Structured Query Language) is a procedural language supported by the PostgreSQL RDBMS. It closely resembles Oracle's PL/SQL language.
PL/pgSQL, as a true programming language, allows much more control than basic SQL, including the ability to use loops and advanced control structures. Programs created in the PL/pgSQL language are called functions, and can be called as part of a SQL statement, or as the action that a trigger performs.
The design goals of PL/pgSQL were to create a loadable procedural language that:
- can be used to create functions and trigger procedures,
- adds control structures to the SQL language,
- can perform complex computations,
- inherits all user-defined types, functions, and operators,
- can be defined to be trusted by the server,
- is easy to use.
PL/pgSQL is the only "PL" language installed by default for PostgreSQL, but many others are available, including PL/Java, PL/Perl, plPHP, PL/Python, PL/R, PL/Ruby, PL/sh, and PL/Tcl.