Table of Contents
Adding PL/pgSQL to your Database
Creating Functions
Handling RECORDS
PL/pgSQL and Triggers

PL/pgSQL is a loadable procedural language for the PostgreSQL database system. PL/pgSQL is similar to the Oracle procedural language PL/SQL. The next section on adding PL/pgSQL to the database will walk you through the steps to loading the PL/pgSQL language for a database. PL/pgSQL is a powerful language that greatly increase the flexibility of the PostgreSQL DBMS. Below is a list of potential benefits to using PL/pgSQL.

  • You can define all C language functions, except those used for input/output. This includes calculated functions for user defined types.

  • You have access to all of the PostgreSQL, data types, operators, and functions.

  • You have access to SQL (Structured Query Language). Developers can create complex programs using PL/pgSQL and SQL.

  • SQL by default allows only the execution of a single statement at a time.You can achieve performance gains due to the processing of multiple statements at one time.

You will also gain large scale portability with the use of PL/pgSQL. This is a result of PL/pgSQL being compatible with all platforms that PostgreSQL supports.