Chapter 38. PL/pgSQL - SQL Procedural Language

Table of Contents
38.1. Overview
38.1.1. Advantages of Using PL/pgSQL
38.1.2. Supported Argument and Result Data Types
38.2. Structure of PL/pgSQL
38.3. Declarations
38.3.1. Aliases for Function Parameters
38.3.2. Copying Types
38.3.3. Row Types
38.3.4. Record Types
38.3.5. RENAME
38.4. Expressions
38.5. Basic Statements
38.5.1. Assignment
38.5.2. Executing a Command With No Result
38.5.3. Executing a Query with a Single-Row Result
38.5.4. Executing Dynamic Commands
38.5.5. Obtaining the Result Status
38.5.6. Doing Nothing At All
38.6. Control Structures
38.6.1. Returning From a Function
38.6.2. Conditionals
38.6.3. Simple Loops
38.6.4. Looping Through Query Results
38.6.5. Trapping Errors
38.7. Cursors
38.7.1. Declaring Cursor Variables
38.7.2. Opening Cursors
38.7.3. Using Cursors
38.7.4. Looping Through a Cursor's Result
38.8. Errors and Messages
38.9. Trigger Procedures
38.10. PL/pgSQL Under the Hood
38.10.1. Variable Substitution
38.10.2. Plan Caching
38.11. Tips for Developing in PL/pgSQL
38.12. Porting from Oracle PL/SQL
38.12.1. Porting Examples
38.12.2. Other Things to Watch For
38.12.3. Appendix