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
6060 - International Standard published
Start Date
01-Jun-2023
Due Date
30-Apr-2023
Completion Date
01-Jun-2023
Ref Project

Relations

Buy Standard

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

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 9075-4:2023(E)
© ISO/IEC 2023

---------------------- Page: 1 ----------------------
ISO/IEC 9075-4:2023(E)
COPYRIGHT PROTECTED DOCUMENT
© 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

---------------------- Page: 2 ----------------------
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

---------------------- Page: 3 ----------------------
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

---------------------- Page: 4 ----------------------
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

---------------------- Page: 5 ----------------------
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

---------------------- Page: 6 ----------------------
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

---------------------- Page: 7 ----------------------
ISO/IEC 9075-4:2023(E)
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

---------------------- Page: 8 ----------------------
ISO/IEC 9075-4:2023(E)
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

---------------------- Page: 9 ----------------------
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

---------------------- Page: 10 ----------------------
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

---------------------- Page: 11 ----------------------
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

---------------------- Page: 12 ----------------------
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

---------------------- Page: 13 ----------------------
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

---------------------- Page: 14 ----------------------
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,andoneormore ...

Questions, Comments and Discussion

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