Information technology - Database languages SQL - Part 4: Persistent stored modules (SQL/PSM)

Technologies de l'information — Langages de base de données SQL — Partie 4: Modules stockés persistants (SQL/PSM)

General Information

Status
Published
Publication Date
31-May-2023
Current Stage
9092 - International Standard to be revised
Start Date
22-Jun-2025
Completion Date
30-Oct-2025

Relations

Effective Date
11-Feb-2023

Overview

ISO/IEC 9075-4:2023 - Information technology - Database languages SQL - Part 4: Persistent stored modules (SQL/PSM) - is the international standard that defines the language elements, semantics and conformance rules for persistent stored modules (procedures, functions, triggers and related program units) within the SQL family. The seventh edition (2023) formalizes the syntax, execution model, diagnostics and metadata views that support creation, invocation and management of SQL-based stored routines.

Key topics and technical scope

This edition organizes comprehensive technical coverage, including:

  • Concepts and notations: SQL-server modules, SQL-schemas, base and temporary tables, SQL-invoked routines, cursors, diagnostics and condition handling.
  • Lexical elements and expressions: tokens, identifiers, scalar expressions, query expressions and variable references.
  • Control and procedural elements: compound statements, control statements (IF, CASE, LOOP, WHILE, FOR, etc.), handlers, condition declarations and variable declarations.
  • Dynamic and embedded SQL: rules for preparing and executing dynamic SQL, embedded SQL host programs and direct invocation contexts.
  • Schema definition & manipulation: DDL elements for modules, tables, columns, views, triggers and related DROP/CREATE semantics.
  • Access control and security: GRANT/REVOKE semantics for module-level privileges and role-based module grants.
  • Diagnostics & status codes: GET DIAGNOSTICS, SIGNAL/RESIGNAL and SQLSTATE status code definitions.
  • Metadata (InformationSchema & DefinitionSchema): standardized views and base tables such as MODULES, ROUTINES, PARAMETERS, MODULE_COLUMN_USAGE, MODULE_PRIVILEGES, MODULE_TABLE_USAGE and ROLE_MODULE_GRANTS for introspection and tooling.
  • Conformance: conformance claims, optional feature taxonomy and annexes covering implementation-defined and deprecated elements.

Practical applications and target users

ISO/IEC 9075-4:2023 is intended for anyone implementing or using SQL stored programs:

  • DBMS vendors and implementers - ensure compliant stored-procedure engines, dynamic SQL handling and metadata exposure.
  • Application developers and database developers - write portable stored procedures, functions and triggers consistent with the SQL standard.
  • DBAs and architects - design secure, maintainable module deployments and manage privileges and schema objects.
  • Tooling and ORM vendors - support standardized information schema views and diagnostics for introspection, migration and code generation.
  • Auditors and QA teams - verify conformance, error handling and security behavior against a recognized international standard.

Related standards

  • Part of the ISO/IEC 9075 (SQL) family - this document complements other parts of the SQL standard that define core query language, data types and additional SQL features.

Keywords: ISO/IEC 9075-4:2023, SQL/PSM, Persistent Stored Modules, SQL standard, stored procedures, dynamic SQL, information schema, MODULES view, SQLSTATE.

Standard

ISO/IEC 9075-4:2023 - Information technology — Database languages SQL — Part 4: Persistent stored modules (SQL/PSM) Released:1. 06. 2023

English language
158 pages
sale 15% off
Preview
sale 15% off
Preview

Frequently Asked Questions

ISO/IEC 9075-4:2023 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology - Database languages SQL - Part 4: Persistent stored modules (SQL/PSM)". This standard covers: Information technology - Database languages SQL - Part 4: Persistent stored modules (SQL/PSM)

Information technology - Database languages SQL - Part 4: Persistent stored modules (SQL/PSM)

ISO/IEC 9075-4:2023 is classified under the following ICS (International Classification for Standards) categories: 35.060 - Languages used in information technology. The ICS classification helps identify the subject area and facilitates finding related standards.

ISO/IEC 9075-4:2023 has the following relationships with other standards: It is inter standard links to ISO/IEC 9075-4:2016/Cor 2:2022. Understanding these relationships helps ensure you are using the most current and applicable version of the standard.

You can purchase ISO/IEC 9075-4:2023 directly from iTeh Standards. The document is available in PDF format and is delivered instantly after payment. Add the standard to your cart and complete the secure checkout process. iTeh Standards is an authorized distributor of ISO standards.

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 9075-4
Seventh edition
2023-06
Information technology — Database
languages SQL —
Part 4:
Persistent stored modules (SQL/PSM)
Technologies de l'information — Langages de base de données SQL —
Partie 4: Modules stockés persistants (SQL/PSM)
Reference number
© ISO/IEC 2023
© ISO/IEC 2023
All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may
be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on
the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below
or ISO’s member body in the country of the requester.
ISO copyright office
CP 401 • Ch. de Blandonnet 8
CH-1214 Vernier, Geneva
Phone: +41 22 749 01 11
Email: copyright@iso.org
Website: www.iso.org
Published in Switzerland
ii
© ISO/IEC 2023 – All rights reserved

ISO/IEC9075-4:2023(E)
Contents Page
Foreword.viii
Introduction.x
1 Scope.1
2 Normativereferences.2
3 Termsanddefinitions.3
4 Concepts.4
4.1 Notationsandconventions.4
4.1.1 Notations.4
4.1.2 Useofterms.4
4.2 SQL-server modules.4
4.3 Tables.5
4.3.1 Basetables.5
4.3.1.1 Temporary tables.5
4.3.2 Uniqueidentificationoftables.5
4.4 SQL-schemas.5
4.5 SQL-invokedroutines.6
4.5.1 OverviewofSQL-invokedroutines.6
4.5.2 ExecutionofconventionalSQL-invokedroutines.6
4.5.3 Routinedescriptors.6
4.6 SQL-paths.6
4.7 Host parameters.6
4.7.1 Statusparameters.6
4.8 Diagnostics area.6
4.9 Condition handling.7
4.10 Cursors.8
4.10.1 Generaldescriptionofcursors.8
4.11 SQL-statements.9
4.11.1 ClassesofSQL-statements.9
4.11.2 SQL-statementsclassifiedbyfunction.9
4.11.2.1 SQL-schemastatements.9
4.11.2.2 SQL-control statements.9
4.11.2.3 SQL-controldeclarations.9
4.11.2.4 SQL-diagnosticsstatements.10
4.11.3 SQL-statementsandtransactionstates.10
4.11.4 SQL-statementatomicityandstatementexecutioncontexts.10
4.11.5 EmbeddableSQL-statements.10
4.11.6 PreparableandimmediatelyexecutableSQL-statements.11
4.11.7 DirectlyexecutableSQL-statements.11
©ISO/IEC2023–Allrightsreserved iii

ISO/IEC9075-4:2023(E)
4.11.8 IteratedSQL-statements.11
4.11.9 Compoundstatements.12
4.12 Basicsecuritymodel.12
4.12.1 Privileges.12
4.13 SQL-sessions.12
4.13.1 GeneraldescriptionofSQL-sessions.12
5 Lexicalelements.13
5.1 and.13
5.2 Namesandidentifiers.15
6 Scalarexpressions.17
6.1 and.17
6.2 .19
6.3 .21
6.4 .22
7 Queryexpressions.23
7.1 .23
7.2 .24
8 Additionalcommonrules.25
8.1 Potentialsourcesofnon-determinism.25
8.2 Executingan.26
8.3 Executinga.27
8.4 InvokinganSQL-invokedroutine.29
8.5 Transformationofqueryspecifications.30
8.6 Handlerexecution.31
9 Additionalcommonelements.34
9.1 .34
10 Schemadefinitionandmanipulation.36
10.1 .36
10.2 .37
10.3 .38
10.4 .39
10.5 .40
10.6 .41
10.7 .42
10.8 .43
10.9 .44
10.10 .45
10.11 .46
10.12 .47
10.13 .48
10.14 .49
10.15 .50
10.16 .51
10.17 .52
10.18 .53
iv ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
10.19 .54
10.20 .55
10.21 .56
10.22 .59
10.23 .60
10.24 .61
10.25 .63
10.26 .64
11 Accesscontrol.65
11.1 .65
11.2 .66
11.3 .67
12 SQL-clientmodules.71
12.1 .71
12.2 .73
13 Datamanipulation.74
13.1 .74
13.2 .75
13.3 .76
13.4 .77
13.5 .78
13.6 .79
13.7 .80
13.8 .81
14 Additionaldatamanipulationrules.82
14.1 Effectofopeningacursor.82
15 Control statements.83
15.1 .83
15.2 .86
15.3 .88
15.4 .89
15.5 .90
15.6 .94
15.7 .97
15.8 .99
15.9 .100
15.10 .101
15.11 .102
15.12 .104
15.13 .105
16 DynamicSQL.108
16.1 .108
16.2 .110
16.3 .111
17 EmbeddedSQL.112
©ISO/IEC2023–Allrightsreserved v

ISO/IEC9075-4:2023(E)
17.1 .112
18 DirectinvocationofSQL.114
18.1 .114
19 Diagnosticsmanagement.115
19.1 .115
19.2 .117
19.3 .119
20 InformationSchema.121
20.1 InformationSchemadigitalartifact.121
20.2 MODULE_COLUMN_USAGEview.121
20.3 MODULE_PRIVILEGESview.123
20.4 MODULE_TABLE_USAGEview.124
20.5 MODULESview.125
20.6 PARAMETERSview.126
20.7 ROLE_MODULE_GRANTS view.127
20.8 ROUTINESview.128
20.9 Shortnameviews.129
21 DefinitionSchema.130
21.1 DefinitionSchemadigitalartifact.130
21.2 MODULE_COLUMN_USAGEbasetable.130
21.3 MODULE_PRIVILEGESbasetable.132
21.4 MODULE_TABLE_USAGEbasetable.134
21.5 MODULESbasetable.135
21.6 ROUTINESbasetable.137
22 Statuscodes.138
22.1 SQLSTATE.138
23 Conformance.139
23.1 ClaimsofconformancetoSQL/PSM.139
23.2 AdditionalconformancerequirementsforSQL/PSM.139
23.3 ImpliedfeaturerelationshipsofSQL/PSM.139
AnnexA(informative) SQLconformancesummary.141
AnnexB(informative) Implementation-defined elements.146
AnnexC(informative) Implementation-dependent elements.148
AnnexD(informative) SQLoptionalfeaturetaxonomy.150
AnnexE(informative) Deprecatedfeatures.152
AnnexF(informative) IncompatibilitieswithISO/IEC9075:2016.153
AnnexG(informative) DefectReportsnotaddressedinthiseditionofthisdocument.154
Index.155
vi ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
Tables
Table Page
1 Datatypesofs.115
2 SQL-statementcodes.116
3 SQLSTATEclassandsubclasscodes.138
4 ImpliedfeaturerelationshipsofSQL/PSM.139
A.1 FeaturedefinitionsoutsideofConformanceRules.141
D.1 Featuretaxonomyforoptionalfeatures.150
©ISO/IEC2023–Allrightsreserved vii

Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission) form the specialized system for worldwide standardization. National bodies that are
members of ISO or IEC participate in the development of International Standards through technical
committees established by the respective organization to deal with particular fields of technical activity.
ISO and IEC technical committees collaborate in fields of mutual interest. Other international
organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the
work.
The procedures used to develop this document and those intended for its further maintenance are
described in the ISO/IEC Directives, Part 1. In particular, the different approval criteria needed for the
different types of document should be noted. This document was drafted in accordance with the editorial
rules of the ISO/IEC Directives, Part 2 (see www.iso.org/directives or
www.iec.ch/members_experts/refdocs).
ISO and IEC draw attention to the possibility that the implementation of this document may involve the
use of (a) patent(s). ISO and IEC take no position concerning the evidence, validity or applicability of any
claimed patent rights in respect thereof. As of the date of publication of this document, ISO and IEC have
not received notice of (a) patent(s) which may be required to implement this document. However,
implementers are cautioned that this may not represent the latest information, which may be obtained
from the patent database available at www.iso.org/patents and https://patents.iec.ch. ISO and IEC shall
not be held responsible for identifying any or all such patent rights.
Any trade name used in this document is information given for the convenience of users and does not
constitute an endorsement.
For an explanation of the voluntary nature of standards, the meaning of ISO specific terms and
expressions related to conformity assessment, as well as information about ISO's adherence to the World
Trade Organization (WTO) principles in the Technical Barriers to Trade (TBT) see
www.iso.org/iso/foreword.html. In the IEC, see www.iec.ch/understanding-standards.
This document was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 32, Data management and interchange.
This seventh edition cancels and replaces the sixth edition (ISO/IEC 9075-4:2016), which has been
technically revised. It also incorporates the Technical Corrigenda ISO/IEC 9075-4:2016/Cor.1:2019 and
ISO/IEC 9075-4:2016/Cor.2:2022.
The main changes are as follows:
— improve the presentation and accuracy of the summaries of implementation-defined and
implementation-dependent aspects of this document;
— introduction of several digital artifacts;
— alignment with updated ISO house style and other guidelines for creating standards.
viii © ISO/IEC 2023 – All rights reserved

This seventh edition of ISO/IEC 9075-4 is designed to be used in conjunction with the following editions
of other parts of the ISO/IEC 9075 series, all published 2023:
— ISO/IEC 9075-1, sixth edition;
— ISO/IEC 9075-2, sixth edition;
— ISO/IEC 9075-3, sixth edition;
— ISO/IEC 9075-9, fifth edition;
— ISO/IEC 9075-10, fifth edition;
— ISO/IEC 9075-11, fifth edition;
— ISO/IEC 9075-13, fifth edition;
— ISO/IEC 9075-14, sixth edition;
— ISO/IEC 9075-15, second edition;
— ISO/IEC 9075-16, first edition.
A list of all parts in the ISO/IEC 9075 series can be found on the ISO and IEC websites.
Any feedback or questions on this document should be directed to the user’s national standards body. A
complete listing of these bodies can be found at www.iso.org/members.html and www.iec.ch/national-
committees.
© ISO/IEC 2023 – All rights reserved ix

ISO/IEC9075-4:2023(E)
Introduction
Theorganizationofthisdocumentisasfollows:
1) Clause1,“Scope”,specifiesthescopeofthisdocument.
2) Clause2,“Normativereferences”,identifiesadditionalstandardsthat,throughreferenceinthis
document,constituteprovisionsofthisdocument.
3) Clause3,“Termsanddefinitions”,definesthetermsanddefinitionsusedinthisdocument.
4) Clause4,“Concepts”,presentsconceptsusedinthedefinitionofpersistentstoredmodules.
5) Clause5,“Lexicalelements”,definesanumberoflexicalelementsusedinthedefinitionofpersistent
storedmodules.
6) Clause6,“Scalarexpressions”,definesanumberofscalarexpressionsusedinthedefinitionof
persistentstoredmodules.
7) Clause7,“Queryexpressions”,definestheelementsofthelanguagethatproducerowsandtables
ofdataasusedinpersistentstoredmodules.
8) Clause8,“Additionalcommonrules”,specifiestherulesforassignmentsthatretrievedatafromor
storedataintoSQL-data,andformationrulesforsetoperations.
9) Clause9,“Additionalcommonelements”,definesadditionalcommonelementsusedinthedefinition
ofpersistentstoredmodules.
10) Clause10,“Schemadefinitionandmanipulation”,definestheschemadefinitionandmanipulation
statementsassociatedwiththedefinitionofpersistentstoredmodules.
11) Clause11,“Accesscontrol”,definesfacilitiesforcontrollingaccesstoSQL-data.
12) Clause12,“SQL-clientmodules”,definesthefacilitiesforusingpersistentstoredmodules.
13) Clause13,“Datamanipulation”,definesdatamanipulationoperationsassociatedwithpersistent
storedmodules.
14) Clause14,“Additionaldatamanipulationrules”,definesadditionalrulesfordatamanipulation.
15) Clause15,“Controlstatements”,definesthecontrolstatementsusedwithpersistentstoredmodules.
16) Clause16,“DynamicSQL”,definesthefacilitiesforexecutingSQL-statementsdynamicallyinthe
contextofpersistentstoredmodules.
17) Clause17,“EmbeddedSQL”,definesthehostlanguageembeddings.
18) Clause18,“DirectinvocationofSQL”,definesdirectinvocationofSQLlanguage.
19) Clause19,“Diagnosticsmanagement”,definesenhancementstothefacilitiesusedwithpersistent
storedmodules.
20) Clause20,“InformationSchema”,definestheInformationandDefinitionSchemaobjectsassociated
withpersistentstoredmodules.
21) Clause21,“DefinitionSchema”,definesbasetablesonwhichtheviewedtablescontainingschema
informationdepend.
22) Clause22,“Statuscodes”,definesSQLSTATEvaluesrelatedtopersistentstoredmodules.
23) Clause23,“Conformance”,definesthecriteriaforconformancetothisdocument.
x ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
24) AnnexA,“SQLconformancesummary”,isaninformativeAnnex.Itsummarizestheconformance
requirementsoftheSQLlanguage.
25) AnnexB,“Implementation-definedelements”,isaninformativeAnnex.Itliststhosefeaturesfor
whichthebodyofthisdocumentstatesthatthesyntax,themeaning,thereturnedresults,theeffect
onSQL-dataand/orschemas,orotheraspectispartlyorwhollyimplementation-defined.
26) AnnexC,“Implementation-dependentelements”,isaninformativeAnnex.Itliststhosefeaturesfor
whichthebodyofthisdocumentstatesthatthesyntax,themeaning,thereturnedresults,theeffect
onSQL-dataand/orschemas,orotheraspectispartlyorwhollyimplementation-dependent.
27) AnnexD,“SQLoptionalfeaturetaxonomy”,isaninformativeAnnex.Itidentifiestheoptionalfeatures
oftheSQLlanguagespecifiedinthisdocumentbyanidentifierandashortdescriptivename.This
taxonomyisusedtospecifyconformance.
28) AnnexE,“Deprecatedfeatures”,isaninformativeAnnex.Itlistsfeaturesthattheresponsible
TechnicalCommitteeintendsnottoincludeinafutureeditionofthisdocument.
29) AnnexF,“IncompatibilitieswithISO/IEC9075:2016”,isaninformativeAnnex.Itlistsincompatib-
ilitieswiththepreviouseditionofthisdocument.
30) AnnexG,“DefectReportsnotaddressedinthiseditionofthisdocument”,isaninformativeAnnex.
ItdescribestheDefectReportsthatwereknownatthetimeofpublicationofthisdocument.Each
oftheseproblemsisaproblemcarriedforwardfromthepreviouseditionoftheISO/IEC9075
series.Nonewproblemshavebeencreatedinthedraftingofthiseditionofthisdocument.
Inthetextofthisdocument,inClause5,“Lexicalelements”,throughClause23,“Conformance”,Subclauses
beginnewpages.Anyresultingblankspaceisnotsignificant.
©ISO/IEC2023–Allrightsreserved xi

INTERNATIONAL STANDARD ISO/IEC 9075-4:2023(E)
Informationtechnology—DatabaselanguageSQL—
Part4:
PersistentStoredModules(SQL/PSM)
1 Scope
Thisdocumentspecifiesthesyntaxandsemanticsofadatabaselanguagefordeclaringandmaintaining
persistentdatabaselanguageroutinesinSQL-servermodules.
Thedatabaselanguageforsandsincludesthe
followingcapabilities.
— Thespecificationofstatementstodirecttheflowofcontrol.
— Theassignmentoftheresultofexpressionstovariablesandparameters.
— ThespecificationofconditionhandlersthatallowSQL-invokedroutinestodealwithvariouscondi-
tionsthatariseduringtheirexecution.
— Thespecificationofstatementstosignalandresignalconditions.
— ThedeclarationofstandingSQL-servercursors.
— Thedeclarationoflocalvariables.
ItalsoincludesthedefinitionoftheInformationSchematablesthatcontainschemainformationpertaining
toSQL-servermodulesandSQL-invokedroutines.
©ISO/IEC2023–Allrightsreserved 1

ISO/IEC9075-4:2023(E)
2 Normativereferences
Thefollowingdocumentsarereferredtointhetextinsuchawaythatsomeoralloftheircontentconsti-
tutesrequirementsofthisdocument.Fordatedreferences,onlytheeditioncitedapplies.Forundated
references,thelatesteditionofthereferenceddocument(includinganyamendments)applies.
ISO/IEC9075-1,Informationtechnology—Databaselanguages—SQL—Part1:Framework
(SQL/Framework)
ISO/IEC9075-2,Informationtechnology—Databaselanguages—SQL—Part2:Foundation
(SQL/Foundation)
ISO/IEC9075-11,Informationtechnology—Databaselanguages—SQL—Part11:Informationand
DefinitionSchemas(SQL/Schemata)
2 ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
3 Termsanddefinitions
Forthepurposesofthisdocument,thetermsanddefinitionsgiveninISO/IEC9075-1andISO/IEC9075-
2apply.
ISOandIECmaintainterminologicaldatabasesforuseinstandardizationatthefollowingaddresses:
— ISOOnlinebrowsingplatform:availableathttps://www.iso.org/obp
— IECElectropedia:availableathttps://www.electropedia.org/
©ISO/IEC2023–Allrightsreserved 3

ISO/IEC9075-4:2023(E)
4 Concepts
ThisClausemodifiesClause4,“Concepts”,inISO/IEC9075-2.
4.1 Notationsandconventions
ThisSubclausemodifiesSubclause4.1,“Notationsandconventions”,inISO/IEC9075-2.
4.1.1 Notations
ThisSubclausemodifiesSubclause4.1.1,“Notations”,inISO/IEC9075-2.
ThenotationsusedinthisdocumentaredefinedinISO/IEC9075-1.
ThesyntaxdefinedinthisdocumentisavailablefromtheISOwebsiteasa“digitalartifact”.See
https://standards.iso.org/iso-iec/9075/-4/ed-7/en/todownloaddigitalartifactsfor
thisdocument.Todownloadthesyntaxdefinedinaplain-textformat,selectthefilenamed
ISO_IEC_9075-4(E)_PSM.bnf.txt.TodownloadthesyntaxdefinedinanXMLformat,selectthe
filenamedISO_IEC_9075-4(E)_PSM.bnf.xml.
4.1.2 Useofterms
ThisSubclausemodifiesSubclause4.1.2,“Useofterms”,inISO/IEC9075-2.
Insertafterthe2ndparagraph: AnSQL-statementS1issaidtobeexecutedasadirectresultofexecuting
anS2ifS2containsS1.
Insertafterthe2ndparagraph: Thephrase“ThescopeofacontainedinaYis
thatY,excludingeverycontainedinthatY”meansthatthescopeofthe
doesnotextendtoSQL-statementscontainedinsuchan;
itdoes,however,extendtotheitself.
4.2 SQL-servermodules
AnSQL-servermoduleisapersistentobjectdefinedinaschemaandidentifiedbyan name>.SQL-servermodulesarecreatedwithsanddestroyedwith modulestatement>sandbysthatdestroytheschemasthatcontainthem.
Ancontainsan,anoptional modulecharactersetspecification>,anoptional,anoptional servermodulepathspecification>,zeroormoreSQL-servermoduledeclaredlocaltemporarytables
specifiedbys,andoneormores.
TheofanSQL-servermoduleisa.Thecharacter
setspecifiedbytheidentifiesthecharacterrepertoire
usedforexpressingthenamesofschemaobjectsusedinthe.The schemaname>specifiedbytheidentifiestheschemanameused
forimplicitqualificationofunqualifiednamesappearinginthe.The
SQL-invokedroutinesofanSQL-servermoduleareinvokedonlyfromSQL-statements.
AnSQL-servermodulehasanSQL-servermoduleauthorizationidentifier,whichissettotheauthorization
identifieroftheowneroftheschemathatcontainstheSQL-servermoduleatthetimetheSQL-server
moduleiscreated.TheSQL-servermoduleauthorizationidentifieractsasthecurrentauthorization
identifierforprivilegedeterminationfortheSQLobjects,ifany,containedintheSQL-servermodule.
4 ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
4.2 SQL-servermodules
AnSQL-servermoduleisdescribedbyanSQL-servermoduledescriptor.AnSQL-servermoduledescriptor
includesthefollowingcomponents.
— TheSQL-servermodulenameoftheSQL-servermodule.
— ThedescriptorofthecharactersetinwhichtheSQL-servermoduleisrepresented.
— ThedefaultschemanameusedforimplicitqualificationofunqualifiednamesintheSQL-server
module.
— TheSQL-servermoduleauthorizationidentifieroftheSQL-servermodule.
— Thelistofschemanamescontainedinthe.
— ThetabledescriptorofeverylocaltemporarytabledeclaredintheSQL-servermodule.
— ThedescriptorofeverySQL-invokedroutinecontainedintheSQL-servermodule.
— Thetextofthe.
— Thecreationtimestamp,ofanimplementation-defined(IV115)timestamptype.
4.3 Tables
ThisSubclausemodifiesSubclause4.17,“Tables”,inISO/IEC9075-2.
4.3.1 Basetables
ThisSubclausemodifiesSubclause4.17.2,“Basetables”,inISO/IEC9075-2.
4.3.1.1 Temporarytables
ThisSubclausemodifiesSubclause4.17.2.4,“Temporarytables”,inISO/IEC9075-2.
Insertafterthe8thparagraph: AnSQL-servermoduledeclaredlocaltemporarytableisadeclaredlocal
temporarytabledefinedinan.AnSQL-servermoduledeclaredlocal
temporarytableiseffectivelymaterializedthefirsttimeanyinthe definition>thatcontainstheisexecuted,anditpersistsforthatSQL-session.
EverySQL-servermoduleineverySQL-sessionthatreferencesanSQL-servermoduledeclaredlocal
temporarytablecausesadistinctinstanceofthatdeclaredlocaltemporarytable(i.e.,amultisetofrows
thatisvisibleonlytothatSQL-servermoduleduringthatSQL-session)tobematerialized.Thatis,the
multisetofrowsthatisreferencedbytheofanSQL-servermoduledeclaredlocaltemporary
tablecannotbesharedbetweenSQL-sessions,norbetweenSQL-servermodulesthatexecuteduringan
SQL-session.
4.3.2 Uniqueidentificationoftables
ThisSubclausemodifiesSubclause4.17.5,“Uniqueidentificationoftables”,inISO/IEC9075-2.
Insertintothe1stparagraph,afterthe4thlistitem:
— TheofanSQL-servermoduledeclaredlocaltemporarytable,togetherwithanSQL-
sessionidentifierandanSQL-servermodulename,uniquelyidentifiesamultisetofrows.
4.4 SQL-schemas
ThisSubclausemodifiesSubclause4.28,“SQL-schemas”,inISO/IEC9075-2.
Insertintothe2ndparagraph,afterthelastlistitem:
— AnSQL-servermoduledescriptor.
©ISO/IEC2023–Allrightsreserved 5

ISO/IEC9075-4:2023(E)
4.5 SQL-invokedroutines
4.5 SQL-invokedroutines
ThisSubclausemodifiesSubclause4.35,“SQL-invokedroutines”,inISO/IEC9075-2.
4.5.1 OverviewofSQL-invokedroutines
ThisSubclausemodifiesSubclause4.35.1,“OverviewofSQL-invokedroutines”,inISO/IEC9075-2.
Insertafterthe3rdparagraph: AnSQL-invokedroutinethatisdefinedinan definition>iscalledanSQL-module-levelroutine.
4.5.2 ExecutionofconventionalSQL-invokedroutines
ThisSubclausemodifiesSubclause4.35.3,“ExecutionofconventionalSQL-invokedroutines”,inISO/IEC
9075-2.
Augmentthe2ndparagraph byadding“SQL-servermodule”tothelistofthecontainingobjects.
4.5.3 Routinedescriptors
ThisSubclausemodifiesSubclause4.35.5,“Routinedescriptors”,inISO/IEC9075-2.
Insertintothe1stparagraph,afterthe18thlistitem:
— IftheSQL-invokedroutineisnotaschema-levelroutine,thentheof
theSQL-servermodulethatincludestheSQL-invokedroutineandtheoftheschema
thatincludestheSQL-servermodule.
4.6 SQL-paths
ThisSubclausemodifiesSubclause4.36,“SQL-paths”,inISO/IEC9075-2.
Insertafterthe3rdparagraph: ThedefinitionofSQL-servermodulesspecifyanSQL-paththatisused
tosearchforthesubjectroutineofawhosesdonotcontaina
whentheiscontainedinthe.
4.7 Hostparameters
ThisSubclausemodifiesSubclause4.37,“Hostparameters”,inISO/IEC9075-2.
4.7.1 Statusparameters
ThisSubclausemodifiesSubclause4.37.2,“Statusparameters”,inISO/IEC9075-2.
Insertafterthe6thparagraph: Iftheisa,thenthe
activeconditionmayresultfromtheactionofsomeexceptionhandlerspecifiedinthe statement>.
4.8 Diagnosticsarea
ThisSubclausemodifiesSubclause4.38,“Diagnosticsarea”,inISO/IEC9075-2.
Insertafterthe5thparagraph: Informationaboutacompletionorexceptionconditionisplacedinto
oneormoreconditionareasofthefirstdiagnosticsareabeforeanyhandlerisactivated.Thediagnostics
areastackisthenpushedsothatthehandlercanaccessthatinformationevenwhileitsownexecution
iscausingthefirstdiagnosticsareatobemodified.
6 ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
4.8 Diagnosticsarea
Insertafterthe5thparagraph: Thefirstdiagnosticsareaisemptiedduringtheexecutionofa statement>.Informationisaddedtothefirstdiagnosticsareaduringtheexecutionofa ment>.
4.9 Conditionhandling
ConditionhandlingisthemethodofhandlingexceptionandcompletionconditionsinSQL/PSM.Condition
handlingprovidesatodefineahandler,specifyingitstype,theexceptionand
completionconditionsitcanresolve,andtheactionittakestodoso.Conditionhandlingalsoprovides
theabilitytoexplicitlysignalexceptionandcompletionconditions.
sspecifythehandlingofexceptionandcompletionconditions. tion>sareoptionallyspecifiedins.Thescopeofaspecified
inCSisCS,excludingeverycontainedinCS.
Aassociatesoneormoreconditionswithahandleraction.Thehandleractionis
an.
AgeneralisonethatisassociatedwiththesSQLEXCEPTION,
SQLWARNING,orNOTFOUND.Allothersarespecifics.
Aconditionrepresentsanerrororinformationalstatecausedbyexecutionofan ment>.Conditionsareraisedtoprovideinformationinadiagnosticsareaabouttheexecutionofan procedurestatement>.
Aisusedtodeclarea,andtooptionallyassociateitwithan
SQLSTATEvalue.IfadoesnotspecifyanSQLSTATEvalue,itdeclaresauser-
definedexceptioncondition.scanbeusedins,s,
ands.
Whenthecontainingaisexecuted,ahandleriscreated
fortheconditionsassociatedwiththat.Acreatedhandlerisactivatedwhenitis
themostappropriatehandlerforanexceptionorcompletionconditionthathasbeenraisedbyanSQL-
statement.Suchahandlerisanactivehandler.
Themostappropriatehandlerisdeterminedduringexecutionofanimplicitorexplicit
orahandlerexecution.Ahandlercannotbethemostappropriatehandlerforanexceptioncondition
thatoccursduringtheexecutionofthathandler.Animplicitisexecutedwhena
orcompleteswithaconditionotherthansuccessfulcompletion
(00000).
Ifthereisnomostappropriatehandlerandtheconditionisanexceptioncondition,thentheSQL-statement
raisingtheexceptionconditionisterminatedwiththatexceptioncondition.Thistypeofexceptioncon-
ditioniscalledanunhandledexceptioncondition.Unhandledexceptionconditionsareexaminedatthe
nextvisiblescopeforhandling.Ifanexceptionconditionremainsunhandledattheoutermost invokedprocedure>or,itisseenbytheSQL-client.EveniftheSQL-clientresolves
theexceptioncondition,executionisnotresumedintheSQL-serverwheretheexceptionconditionwas
raised.
Ifthereisnomostappropriatehandlerandtheconditionisacompletioncondition,thenexecutionis
resumedasspecifiedinSubclause6.3.3.7,“Exceptions”,inISO/IEC9075-1.Thistypeofcompletioncon-
ditioniscalledanunhandledcompletioncondition.
AhandlertypespecifiesCONTINUE,EXIT,orUNDO.
IfahandlertypespecifiesCONTINUE,then,whenthehandlerisactivated,itwillperformthefollowing
actions.
— Pushthediagnosticsareastack.
©ISO/IEC2023–Allrightsreserved 7

ISO/IEC9075-4:2023(E)
4.9 Conditionhandling
— Executethehandleraction.
— Popthediagnosticsareastack.
— CausetheSQL-sessiontocontinueasitwouldhavedoneifexecutionoftheinnermostexecuting
statementthatraisedtheconditionhadcompleted.
IfahandlertypespecifiesEXIT,then,whenthehandlerisactivated,itwillperformthefollowingactions.
— Pushthediagnosticsareastack.
— Executethehandleraction.
— Popthediagnosticsareastack.
— ImplicitlyLEAVEtheforwhichthehandlerwascreated,withnoactive
exceptioncondition.
IfahandlertypespecifiesUNDO,then,whenthehandlerisactivated,itwillperformthefollowingactions.
— Pushthediagnosticsareastack.
— RollbackallofthechangestoSQL-dataortoschemasbytheexecutionofeverySQL-statement
containedintheSQL-statementlistoftheatthescopeofthehandlerand
cancelallstriggeredbytheexecutionofsuchstatements.
— Executethehandleraction.
— Popthediagnosticsareastack.
— CausetheSQL-sessiontocontinueasitwouldhavedoneifexecutionofthe
forwhichthehandlerwascreatedhadcompleted.
Ifacompleteswithacompletioncondition:successfulcompletion(00000),thenitwas
abletoresolvethecondition,andexecutionresumesasspecifiedinSubclause15.2,“ tion>”.
Ifacompleteswithanexceptionorcompletionconditionotherthansuccessfulcompletion
(00000),thenanimplicitisexecuted.Thedetermineswhether
thereisanotherthatcanresolvethecondition.
4.10 Cursors
ThisSubclausemodifiesSubclause4.40,“Cursors”,inISO/IEC9075-2.
4.10.1 Generaldescriptionofcursors
ThisSubclausemodifiesSubclause4.40.1,“Generaldescriptionofcursors”,inISO/IEC9075-2.
Insertafterthe2ndparagraph: Acursorspecifiedbyacontainedinan moduledefinition>withoutaninterveningisastandingSQL-clientcursor.A
cursorspecifiedbyacontainedinaisastandingSQL-server
cursor.
Augmentthe3rdparagraph byadding“containedintheofa statement>.”asanotheroptionforthecontainmentofthecursor.
Augmentthe5thparagraph,the2ndlistitem,the1stlistitembyadding“oranindicationofa statement>.”immediatelyafter“thenanindicationofanSQL-clientmodule”.
8 ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
4.10 Cursors
Insertafterthe10thparagraph: Foreveryina,astanding
SQL-servercursoriseffectivelycreatedeachtimetheisexecutedanddestroyed
whenthatexecutioncompletes.
NOTE1—Destroyinganopenwith-returncursordoesnotsimultaneouslydestroythatcursor’sresultset.
4.11 SQL-statements
ThisSubclausemodifiesSubclause4.41,“SQL-statements”,inISO/IEC9075-2.
4.11.1 ClassesofSQL-statements
ThisSubclausemodifiesSubclause4.41.1,“ClassesofSQL-statements”,inISO/IEC9075-2.
Insertintothe5thparagraph,afterthelastlistitem:
— SQL-controldeclarations
4.11.2 SQL-statementsclassifiedbyfunction
ThisSubclausemodifiesSubclause4.41.2,“SQL-statementsclassifiedbyfunction”,inISO/IEC9075-2.
4.11.2.1 SQL-schemastatements
ThisSubclausemodifiesSubclause4.41.2.1,“SQL-schemastatements”,inISO/IEC9075-2.
Insertintothe1stparagraph,afterthelastlistitem:


4.11.2.2 SQL-controlstatements
ThisSubclausemodifiesSubclause4.41.2.6,“SQL-controlstatements”,inISO/IEC9075-2.
Insertintothe1stparagraph,afterthelastlistitem:










4.11.2.3 SQL-controldeclarations
ThefollowingaretheSQL-controldeclarations:

©ISO/IEC2023–Allrightsreserved 9

ISO/IEC9075-4:2023(E)
4.11 SQL-statements


4.11.2.4 SQL-diagnosticsstatements
ThisSubclausemodifiesSubclause4.41.2.8,“SQL-diagnosticsstatements”,inISO/IEC9075-2.
Insertintothe1stparagraph,afterthelastlistitem:


4.11.3 SQL-statementsandtransactionstates
ThisSubclausemodifiesSubclause4.41.4,“SQL-statementsandtransactionstates”,inISO/IEC9075-2.
Insertintothe1stparagraph,afterthelastlistitem:

Insertintothe4thparagraph,afterthelastlistitem:


Insertintothe5thparagraph,afterthelastlistitem:
— SQL-controlstatementsotherthan:



4.11.4 SQL-statementatomicityandstatementexecutioncontexts
ThisSubclausemodifiesSubclause4.41.5,“SQL-statementatomicityandstatementexecutioncontexts”,in
ISO/IEC9075-2.
Insertintothe2ndparagraph,afterthelastlistitem:
— .
— .
— ,unlessBEGINATOMICisspecified.
— .
— .
— .
— .
— .
4.11.5 EmbeddableSQL-statements
ThisSubclausemodifiesSubclause4.41.6,“EmbeddableSQL-statements”,inISO/IEC9075-2.
10 ©ISO/IEC2023–Allrightsreserved

ISO/IEC9075-4:2023(E)
4.11 SQL-statements
Insertintothe1stparagraph,inthe8thlistitem,afterthelastlistitem:
— AllotherSQL-controlstatements
NOTE2—SQL-controldeclarationscontainedin(forexample)sarepermitted,evenwhenthe
containingSQL-statementisembeddedinan.
4.11.6 PreparableandimmediatelyexecutableSQL-statements
ThisSubclausemodifiesSubclause4.41.7,“PreparableandimmediatelyexecutableSQL-statements”,in
ISO/IEC9075-2.
Insertintothe2ndparagraph,inthe6thlistitem,afterthelastlistitem:










Insertintothe2ndparagraph,afterthelastlistitem:Consequently,thefollowingSQL-controldeclarations
arenotpreparable:



4.11.7 Directlyexecutabl
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...

この記事では、SQLデータベース言語の一部である新しい規格であるISO/IEC 9075-4:2023について議論しています。この規格は、永続的なストアドモジュール(SQL/PSM)に焦点を当てています。SQL/PSMを使用すると、ユーザーはデータベース内で手続きや関数を定義し、実行することができます。これはSQLデータベース内でデータを格納し操作するための標準化された方法を提供します。新しい規格は、さまざまなデータベースシステム間の相互運用性と互換性を向上させることを目的としています。また、新しいデータ型や制御フロー文など、言語の改良も含まれています。この記事では、データベース技術の進歩のために、この規格の重要性が強調されています。

The article discusses a new standard, ISO/IEC 9075-4:2023, which is part of the SQL database languages. This particular part focuses on persistent stored modules (SQL/PSM). SQL/PSM allows users to define and execute procedures and functions within a database. It provides a standardized way to store and manipulate data within SQL databases. The new standard aims to improve interoperability and compatibility between different database systems. It also includes enhancements to the language, such as new datatypes and control flow statements. The article highlights the importance of this standard for the advancement of database technology.

이 기사는 SQL 데이터베이스 언어의 일부인 새로운 표준인 ISO/IEC 9075-4:2023에 관해 이야기한다. 이 표준은 영구 저장 모듈(SQL/PSM)에 초점을 맞추고 있다. SQL/PSM을 사용하면 사용자는 데이터베이스 내에서 프로시저와 함수를 정의하고 실행할 수 있다. 이는 SQL 데이터베이스 내에서 데이터를 저장하고 조작하기 위한 표준화된 방법을 제공한다. 새로운 표준은 서로 다른 데이터베이스 시스템 간의 상호 운용성과 호환성을 향상시키기 위해 개발되었다. 또한, 새로운 데이터 타입과 제어 흐름 문장 등 언어에 대한 개선 사항도 포함하고 있다. 이 기사는 데이터베이스 기술의 발전을 위해 이 표준의 중요성을 강조한다.