Home
About
Download
Documentation
Community
Developers
Support
Donate
Your account
November 14, 2024:
PostgreSQL 17.1, 16.5, 15.9, 14.14, 13.17, and 12.21 Released!
Documentation
→
PostgreSQL 9.5
Supported Versions:
Current
(
17
) /
16
/
15
/
14
/
13
Development Versions:
devel
Unsupported versions:
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 the
current
version, or one of the other supported versions listed above instead.
PostgreSQL 9.5.25 Documentation
Prev
Up
Next
Chapter 40.
PL/pgSQL
-
SQL
Procedural Language
Table of Contents
40.1.
Overview
40.1.1.
Advantages of Using
PL/pgSQL
40.1.2.
Supported Argument and Result Data Types
40.2.
Structure of
PL/pgSQL
40.3.
Declarations
40.3.1.
Declaring Function Parameters
40.3.2.
ALIAS
40.3.3.
Copying Types
40.3.4.
Row Types
40.3.5.
Record Types
40.3.6.
Collation of
PL/pgSQL
Variables
40.4.
Expressions
40.5.
Basic Statements
40.5.1.
Assignment
40.5.2.
Executing a Command With No Result
40.5.3.
Executing a Query with a Single-row Result
40.5.4.
Executing Dynamic Commands
40.5.5.
Obtaining the Result Status
40.5.6.
Doing Nothing At All
40.6.
Control Structures
40.6.1.
Returning From a Function
40.6.2.
Conditionals
40.6.3.
Simple Loops
40.6.4.
Looping Through Query Results
40.6.5.
Looping Through Arrays
40.6.6.
Trapping Errors
40.6.7.
Obtaining Execution Location Information
40.7.
Cursors
40.7.1.
Declaring Cursor Variables
40.7.2.
Opening Cursors
40.7.3.
Using Cursors
40.7.4.
Looping Through a Cursor's Result
40.8.
Errors and Messages
40.8.1.
Reporting Errors and Messages
40.8.2.
Checking Assertions
40.9.
Trigger Procedures
40.9.1.
Triggers on Data Changes
40.9.2.
Triggers on Events
40.10.
PL/pgSQL
Under the Hood
40.10.1.
Variable Substitution
40.10.2.
Plan Caching
40.11.
Tips for Developing in
PL/pgSQL
40.11.1.
Handling of Quotation Marks
40.11.2.
Additional Compile-time Checks
40.12.
Porting from
Oracle
PL/SQL
40.12.1.
Porting Examples
40.12.2.
Other Things to Watch For
40.12.3.
Appendix
Prev
Home
Next
Installing Procedural Languages
Up
Overview