SQL/PSM
SQL extension
title: "SQL/PSM" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["data-management", "sql", "data-centric-programming-languages", "programming-languages-created-in-1996"] description: "SQL extension" topic_path: "technology/databases" source: "https://en.wikipedia.org/wiki/SQL/PSM" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary SQL extension ::
::data[format=table title="infobox programming language"]
| Field | Value |
|---|---|
| name | SQL/PSM |
| paradigm | Multi-paradigm |
| year | 1996 |
| latest_release_version | SQL:2023 |
| turing-complete | Yes |
| implementations | PL/SQL |
| MySQL/MariaDB | |
| IBM's SQL PL | |
| Mimer SQL | |
| influenced_by | PL/SQL |
| Ada | |
| operating_system | Cross-platform (multi-platform) |
| :: |
| name = SQL/PSM | logo = | paradigm = Multi-paradigm | year = 1996 | designer = | developer = | latest_release_version = SQL:2023 | latest_release_date = | latest_preview_version = | latest_preview_date = | turing-complete = Yes | typing = | implementations = PL/SQL MySQL/MariaDB IBM's SQL PL Mimer SQL | influenced_by = PL/SQL Ada | influenced = | operating_system = Cross-platform (multi-platform) | license = | website = | file_ext = | dialects = | wikibooks =
SQL/PSM (SQL/Persistent Stored Modules) is an ISO standard mainly defining an extension of SQL with a procedural language for use in stored procedures. Initially published in 1996 as an extension of SQL-92 (ISO/IEC 9075-4:1996, a version sometimes called PSM-96 or even SQL-92/PSM), SQL/PSM was later incorporated into the multi-part SQL:1999 standard, and has been part 4 of that standard since then, most recently in SQL:2023. The SQL:1999 part 4 covered less than the original PSM-96 because the SQL statements for defining, managing, and invoking routines were actually incorporated into part 2 SQL/Foundation, leaving only the procedural language itself as SQL/PSM. The SQL/PSM facilities are still optional as far as the SQL standard is concerned; most of them are grouped in Features P001-P008.
SQL/PSM standardizes syntax and semantics for control flow, exception handling (called "condition handling" in SQL/PSM), local variables, assignment of expressions to variables and parameters, and (procedural) use of cursors. It also defines an information schema (metadata) for stored procedures. SQL/PSM is one language in which methods for the SQL:1999 structured types can be defined. The other is Java, via SQL/JRT.
SQL/PSM is derived, seemingly directly, from Oracle's PL/SQL. Oracle developed PL/SQL and released it in 1991, basing the language on the US Department of Defense's Ada programming language. However, Oracle has maintained a distance from the standard in its documentation. IBM's SQL PL (used in DB2) and Mimer SQL's PSM were the first two products officially implementing SQL/PSM. It is commonly thought that these two languages, and perhaps also MySQL/MariaDB's procedural language, are closest to the SQL/PSM standard. However, a PostgreSQL addon implements SQL/PSM (alongside its other procedural languages like the PL/SQL-derived plpgsql), although it is not part of the core product.
RDF functionality in OpenLink Virtuoso was developed entirely through SQL/PSM, combined with custom datatypes (e.g., ANY for handling URI and Literal relation objects), sophisticated indexing, and flexible physical storage choices (column-wise or row-wise).
References
References
- (2015). "Stored Procedures: critiques and defences".
- (1996). "New standard for stored procedures in SQL". ACM SIGMOD Record.
- "Catalogue". ISO.
- (2002). "SQL: 1999". Morgan Kaufmann.
- "Stored Procedures in Mimer SQL".
- (2008). "MySQL Stored Procedure Programming". O'Reilly.
- "Stored Procedures".
- (7 July 2020). "plpsm0".
- (May 2011). "Announce". PostgreSQL.
- (22 February 2012). "PostgreSQL: Proposal: PL/pgPSM for 9.3".
- (2008). "SQL/PSM". PostgreSQL.
- "Documentation". PostgreSQL.
- "Chapter 8. SQL-Invoked Routines".
- "Chapter 11. SQL Procedure Language Guide".
- "Invantive SQL v2.0 Grammar".
- "Mimer SQL Stored Procedures".
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::