PL/pgSQL - SQL Procedural Language (original) (raw)

DocumentationPostgreSQL 9.1

Supported Versions:Current (18) / 17 / 16 / 15 / 14

Development Versions:19 / devel

Unsupported versions:13 / 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2 / 7.1

This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for thecurrent version, or one of the other supported versions listed above instead.

PostgreSQL 9.1.24 Documentation
Prev Up Next

Table of Contents

39.1. Overview

39.1.1. Advantages of Using PL/pgSQL

39.1.2. Supported Argument and Result Data Types

39.2. Structure ofPL/pgSQL

39.3. Declarations

39.3.1. Declaring Function Parameters

39.3.2. ALIAS

39.3.3. Copying Types

39.3.4. Row Types

39.3.5. Record Types

39.3.6. Collation of PL/pgSQL Variables

39.4. Expressions

39.5. Basic Statements

39.5.1. Assignment

39.5.2. Executing a Command With No Result

39.5.3. Executing a Query with a Single-row Result

39.5.4. Executing Dynamic Commands

39.5.5. Obtaining the Result Status

39.5.6. Doing Nothing At All

39.6. Control Structures

39.6.1. Returning From a Function

39.6.2. Conditionals

39.6.3. Simple Loops

39.6.4. Looping Through Query Results

39.6.5. Looping Through Arrays

39.6.6. Trapping Errors

39.7. Cursors

39.7.1. Declaring Cursor Variables

39.7.2. Opening Cursors

39.7.3. Using Cursors

39.7.4. Looping Through a Cursor's Result

39.8. Errors and Messages

39.9. Trigger Procedures

39.10. PL/pgSQL Under the Hood

39.10.1. Variable Substitution

39.10.2. Plan Caching

39.11. Tips for Developing in PL/pgSQL

39.12. Porting fromOracle PL/SQL

39.12.1. Porting Examples

39.12.2. Other Things to Watch For

39.12.3. Appendix


Prev Home Next
Installing Procedural Languages Up Overview