Chapter 5. PL/PGSQL

PostgreSQL provides a special programming language for developing functions within SQL code. This programming language (that's the reason why it is called PL/pgSQL) offers the programmer far more execution potential than simple SELECT, INSERT, or UPDATE commands. The power of PL/pgSQL can be used to solve problems that cannot be solved with pure SQL statements. The package was initially written by Jan Wieck. Let's take a look at the main ideas and basic concepts of PL/pgSQL.

PL/pgSQL is a procedural language and is similar to Oracle's PL/SQL (see the section titled “Why Use PL/pgSQL,” later in this chapter). Like PL/SQL, PL/pgSQL is a block-oriented language that supports variable declaration, loops, logical constructs, and ...

Get PostgreSQL Developer's Handbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.