Você está na página 1de 15

AS ISO/IEC 9075.

14—2005
ISO/IEC 9075-14:2003
AS ISO/IEC 9075.14—2005

Australian Standard™
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

Information technology—Database
languages—SQL

Part 14: XML-Related Specifications


(SQL/XML)
This Australian Standard was prepared by Committee IT-027, Data Management
and Interchange. It was approved on behalf of the Council of Standards Australia on
16 May 2005. This Standard was published on 16 June 2005.

The following are represented on Committee IT-027:

Association of Superannuation Funds of Australia


Australia Post
Australia Bankers Association
Australian Bureau of Statistics
Australian Computer Society
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

Australian Customs Service


Australian Electoral Commission
Australian Electric and Electronic Manufacturers Association
Australian Industry Group
Australian Information Industry Association
Australian Institute of Health and Welfare
Australian Taxation Office
Centrelink
Department of Defence
Department of Immigration, Multicultural and Indigenous Affairs
Health Insurance Commission
Data Management Association Australia

Keeping Standards up-to-date


Standards are living documents which reflect progress in science, technology and
systems. To maintain their currency, all Standards are periodically reviewed, and
new editions are published. Between editions, amendments may be issued.
Standards may also be withdrawn. It is important that readers assure themselves
they are using a current Standard, which should include any amendments which
may have been published since the Standard was purchased.
Detailed information about Standards can be found by visiting the Standards Web
Shop at www.standards.com.au and looking up the relevant Standard in the on-line
catalogue.
Alternatively, the printed Catalogue provides information current at 1 January each
year, and the monthly magazine, The Global Standard, has a full listing of revisions
and amendments published each month.
Australian StandardsTM and other products and services developed by Standards
Australia are published and distributed under contract by SAI Global, which
operates the Standards Web Shop.
We also welcome suggestions for improvement in our Standards, and especially
encourage readers to notify us immediately of any apparent inaccuracies or
ambiguities. Contact us via email at mail@standards.org.au, or write to the Chief
Executive, Standards Australia, GPO Box 5420, Sydney, NSW 2001.

This Standard was issued in draft form for comment as DR 05151.


AS ISO/IEC 9075.14—2005

Australian Standard™
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

Information technology—Database
languages—SQL

Part 14: XML-Related Specifications


(SQL/XML)

First published as AS ISO/IEC 9075.14—2005.

COPYRIGHT
© Standards Australia
All rights are reserved. No part of this work may be reproduced or copied in any form or by
any means, electronic or mechanical, including photocopying, without the written
permission of the publisher.
Published by Standards Australia GPO Box 5420, Sydney, NSW 2001, Australia
ISBN 0 7337 6772 9
ii

PREFACE

This Standard was prepared by the Standards Australia Committee IT-027, Data Management
and Interchange.
This Standard is identical with, and has been reproduced from ISO/IEC 9075-14:2003,
Information technology—Database languages—SQL—Part 14: XML-Related Specifications
(SQL/XML).
The objective of this Standard is to provide database designers, administrators and developers
with definitions of the ways in which database language SQL can be used with XML.
This Standard is Part 14 of AS 9075, Information technology—Database languages—SQL,
which is published in parts as follows:
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

Part 1: Framework (SQL/Framework)


Part 2: Foundation (SQL/Foundation)
Part 3: Call-Level Interface (SQL/CLI)
Part 4: Persistent Stored Modules (SQL/PSM)
Part 5: Host Language Bindings (SQL/Bindings)
Part 9: Management of External Data (SQL/MED)
Part 10: Object Language Bindings (SQL/OLB)
Part 11: Information and Definition Schemas (SQL/Schemata)
Part 13: SQL Routines and Types Using the Java Programming Language (SQL/JRT)
Part 14: XML-Related Specifications (SQL/XML) (this Standard)
As this Standard is reproduced from an international standard, the following applies:
(a) Its number appears on the cover and title page while the international standard number
appears only on the cover.
(b) In the source text ‘this part of ISO/IEC 9075’ should read ‘this Australian Standard’.
(c) A full point substitutes for a comma when referring to a decimal marker.
References to International Standards should be replaced by references to Australian or
Australian/New Zealand Standards, as follows:
Reference to International Standard Australian Standard
ISO/IEC AS
9075 Information technology—Database 9075 Information technology—Database
languages—SQL languages—SQL
9075-1 Part 1: Framework (SQL/Framework) 9075.1 Part 1: Framework (SQL/Framework)
9075-2 Part 2: Foundation (SQL/Foundation) 9075.2 Part 2: Foundation (SQL/Foundation)
9075-11 Part 11: Information and Definition 9075.11 Part 11: Information and Definition
Schemas (SQL/Schemas) Schemas (SQL/Schemas)
Only referenced documents that have been adopted as Australian or Australian/New Zealand
Standards have been listed.
iii

CONTENTS ISO/IEC 9075-14:2003 (E)

Page

Contents Page

Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
1 Scope. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Normative references. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

2.1 JTC1 standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3


2.2 Other international standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Definitions, notations and conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1 Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.1 Definitions taken from XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.2 Definitions taken from XML Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.3 Definitions provided in Part 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Notation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.1 Data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.1.1 Naming of predefined types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.1.2 Comparison and ordering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2.1 Characteristics of XML values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2.2 XML comparison and assignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2.3 Operations involving XML values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Data analysis operations (involving tables). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3.1 Aggregate functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4 SQL-invoked routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4.1 Routine descriptors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.5 SQL-statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.5.1 SQL-statements classified by function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.5.1.1 SQL-session statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.6 SQL-sessions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.6.1 SQL-session properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.7 XML namespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.8 Overview of mappings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.8.1 Mapping SQL character sets to Unicode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.8.2 Mapping SQL <identifier>s to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.8.3 Mapping SQL data types to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.8.4 Mapping values of SQL data types to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.8.5 Visibility of columns, tables, and schemas in mappings from SQL to XML. . . . . . . . . . . . . . . . . . . . . . . . . . 16

©ISO/IEC 2003 – All rights reserved Contents iii


iv

Page
ISO/IEC 9075-14:2003 (E)

4.8.6 Mapping an SQL table to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17


4.8.7 Mapping an SQL schema to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.8.8 Mapping an SQL catalog to XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.8.9 Mapping Unicode to SQL character sets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.8.10 Mapping XML Names to SQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Lexical elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1 <token> and <separator>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6 Scalar expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.1 <data type>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

6.2 <field definition>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25


6.3 <cast specification>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.4 <value expression>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.5 <string value function>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.6 <XML value expression>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.7 <XML value function>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.8 <XML concatenation>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.9 <XML element>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.10 <XML forest>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.11 <XML parse>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.12 <XML root>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7 Query expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.1 <query expression>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8 Predicates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.1 <predicate>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.2 <XML document predicate>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
9 Mappings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
9.1 Mapping SQL <identifier>s to XML Names. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
9.2 Mapping a multi-part SQL name to an XML Name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
9.3 Mapping an SQL table to XML and an XML Schema document. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.4 Mapping an SQL schema to an XML document and an XML Schema document. . . . . . . . . . . . . . . . . . . . . 60
9.5 Mapping an SQL catalog to an XML document and an XML Schema document. . . . . . . . . . . . . . . . . . . . . . 65
9.6 Mapping an SQL table to XML Schema data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
9.7 Mapping an SQL schema to XML Schema data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
9.8 Mapping an SQL catalog to XML Schema data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
9.9 Mapping an SQL data type to an XML Name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
9.10 Mapping a collection of SQL data types to XML Schema data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
9.11 Mapping an SQL data type to a named XML Schema data type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
9.12 Mapping an SQL table to an XML element or an XML forest. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
9.13 Mapping an SQL schema to an XML element. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.14 Mapping an SQL catalog to an XML element. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
9.15 Mapping SQL data types to XML Schema data types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

iv XML-Related Specifications (SQL/XML) ©ISO/IEC 2003 – All rights reserved


v

Page
ISO/IEC 9075-14:2003 (E)

9.16 Mapping values of SQL data types to values of XML Schema data types. . . . . . . . . . . . . . . . . . . . . . . . . . 114
9.17 Mapping XML Names to SQL <identifier>s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
10 Additional common rules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
10.1 Type precedence list determination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
10.2 Type name determination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
10.3 Determination of identical values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
10.4 Equality operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
10.5 Grouping operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
10.6 Multiset element grouping operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

10.7 Ordering operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129


10.8 Determination of [namespace name] property. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
10.9 Determination of [namespace attributes] property. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
10.10 Determination of the [in-scope namespaces] property. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
10.11 Determination of [whitespace element content] property. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
10.12 Concatenation of two XML values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
10.13 Serialization of an XML value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
10.14 Parsing a character string as an XML value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
11 Additional common elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.1 <routine invocation>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
11.2 <aggregate function>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
11.3 <XML namespace declaration>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
12 Schema definition and manipulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.1 <column definition>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
12.2 <check constraint definition>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12.3 <view definition>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
12.4 <assertion definition>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
12.5 <user-defined type definition>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
12.6 <attribute definition>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
12.7 <SQL-invoked routine>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
13 SQL-client modules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
13.1 Calls to an <externally-invoked procedure>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
13.2 <SQL-procedure statement>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
13.3 Data type correspondences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
14 Data manipulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
14.1 <delete statement: searched>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
14.2 <insert statement>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
14.3 <merge statement>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
14.4 <update statement: positioned>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
14.5 <update statement: searched>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
15 Control statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
15.1 <compound statement>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

©ISO/IEC 2003 – All rights reserved Contents v


vi

Page
ISO/IEC 9075-14:2003 (E)

16 Session management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173


16.1 <set XML option statement>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
17 Dynamic SQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
17.1 Description of SQL descriptor areas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
17.2 <input using clause>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
17.3 <output using clause>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
18 Embedded SQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
18.1 <embedded SQL host program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
18.2 <embedded SQL Ada program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

18.3 <embedded SQL C program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188


18.4 <embedded SQL COBOL program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
18.5 <embedded SQL Fortran program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
18.6 <embedded SQL MUMPS program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
18.7 <embedded SQL Pascal program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
18.8 <embedded SQL PL/I program>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
19 Diagnostics management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
19.1 <get diagnostics statement>. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
20 Information Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
20.1 PARAMETERS view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
20.2 ROUTINES view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
20.3 Short name views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
21 Definition Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
21.1 DATA_TYPE_DESCRIPTOR base table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
21.2 PARAMETERS base table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
21.3 ROUTINES base table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
22 The SQL/XML XML Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
22.1 The SQL/XML XML Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
23 Status codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
23.1 SQLSTATE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
24 Conformance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
24.1 Claims of conformance to SQL/XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
24.2 Additional conformance requirements for SQL/XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
24.3 Implied feature relationships of SQL/XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Annex A SQL Conformance Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Annex B Implementation-defined elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Annex C Implementation-dependent elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Annex D Incompatibilities with ISO/IEC 9075:1999. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Annex E SQL feature taxonomy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

vi XML-Related Specifications (SQL/XML) ©ISO/IEC 2003 – All rights reserved


vii

Page
ISO/IEC 9075-14:2003 (E)

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

©ISO/IEC 2003 – All rights reserved Contents vii


viii

TABLES ISO/IEC 9075-14:2003 (E)

Page

Tables
Table Page

1 XML namespace prefixes and their URIs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13


2 SQL/XML Information Item Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
3 Data type correspondences for Ada. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

4 Data type correspondences for C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162


5 Data type correspondences for COBOL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6 Data type correspondences for Fortran. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7 Data type correspondences for M. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
8 Data type correspondences for Pascal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
9 Data type correspondences for PL/I. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
10 Codes used for SQL data types in Dynamic SQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
11 SQL-statement codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
12 SQLSTATE class and subclass values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
13 Implied feature relationships of SQL/XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
14 Feature taxonomy for optional features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

©ISO/IEC 2003 – All rights reserved Contents viii


ix

ISO/IEC 9075-14:2003 (E) INTRODUCTION

Introduction

The organization of this part of ISO/IEC 9075 is as follows:


1) Clause 1, “Scope”, specifies the scope of this part of ISO/IEC 9075.
2) Clause 2, “Normative references”, identifies additional standards that, through reference in this part of
ISO/IEC 9075, constitute provisions of this part of ISO/IEC 9075.
3) Clause 3, “Definitions, notations and conventions”, defines the notations and conventions used in this part
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

of ISO/IEC 9075.
4) Clause 4, “Concepts”, presents concepts related to this part of ISO/IEC 9075.
5) Clause 5, “Lexical elements”, defines the lexical elements of the language.
6) Clause 6, “Scalar expressions”, defines the elements of the language that produce scalar values.
7) Clause 7, “Query expressions”, defines the elements of the language that produce rows and tables of data.
8) Clause 8, “Predicates”, defines the predicates of the language.
9) Clause 9, “Mappings”, defines the ways in which certain SQL information can be mapped into XML and
certain XML information can be mapped into SQL.
10) Clause 10, “Additional common rules”, specifies the rules for assignments that retrieve data from or store
data into SQL-data, and formation rules for set operations.
11) Clause 11, “Additional common elements”, defines additional language elements that are used in various
parts of the language.
12) Clause 12, “Schema definition and manipulation”, defines facilities for creating and managing a schema.
13) Clause 13, “SQL-client modules”, defines SQL-client modules and externally-invoked procedures.
14) Clause 14, “Data manipulation”, defines the data manipulation statements.
15) Clause 15, “Control statements”, defines the SQL-control statements.
16) Clause 16, “Session management”, defines the SQL-session management statements.
17) Clause 17, “Dynamic SQL”, defines the SQL dynamic statements.
18) Clause 18, “Embedded SQL”, defines the host language embeddings.
19) Clause 19, “Diagnostics management”, defines the diagnostics management facilities.
20) Clause 20, “Information Schema”, defines viewed tables that contain schema information.
21) Clause 21, “Definition Schema”, defines base tables on which the viewed tables containing schema infor-
mation depend.
22) Clause 22, “The SQL/XML XML Schema”, defines the content of an XML namespace that is used when
SQL and XML are utilized together.

x XML-Related Specifications (SQL/XML) ©ISO/IEC 2003 – All rights reserved


x

ISO/IEC 9075-14:2003 (E)

23) Clause 23, “Status codes”, defines values that identify the status of the execution of SQL-statements and
the mechanisms by which those values are returned.
24) Clause 24, “Conformance”, specifies the way in which conformance to this part of ISO/IEC 9075 may be
claimed.
25) Annex A, “SQL Conformance Summary”, is an informative Annex. It summarizes the conformance
requirements of the SQL language.
26) Annex B, “Implementation-defined elements”, is an informative Annex. It lists those features for which
this part of ISO/IEC 9075 states that the syntax, the meaning, the returned results, the effect on SQL-data
and/or schemas, or any other behavior is partly or wholly implementation-defined.
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

27) Annex C, “Implementation-dependent elements”, is an informative Annex. It lists those features for which
this part of ISO/IEC 9075 states that the syntax, the meaning, the returned results, the effect on SQL-data
and/or schemas, or any other behavior is partly or wholly implementation-dependent.
28) Annex D, “Incompatibilities with ISO/IEC 9075:1999”, is an informative Annex. It lists incompatibilities
with the previous version of ISO/IEC 9075.
29) Annex E, “SQL feature taxonomy”, is an informative Annex. It identifies features and packages of the SQL
language specified in this part of ISO/IEC 9075 by an identifier and a short descriptive name. This taxonomy
is used to specify conformance to the packages specified in this part of ISO/IEC 9075. The feature taxonomy
may be used to develop profiles involving the SQL language.
In the text of this part of ISO/IEC 9075, Clauses begin a new odd-numbered page. Any resulting blank space
is not significant.

©ISO/IEC 2003 – All rights reserved Introduction xi


1

AUSTRALIAN STANDARD

Information technology — Database languages — SQL —


Part 14:
XML-Related Specifications (SQL/XML)

1 Scope
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

This part of ISO/IEC 9075 defines ways in which Database Language SQL can be used in conjunction with
XML.

©ISO/IEC 2003 – All rights reserved Scope 1

www.standards.com.au © Standards Australia


2

ISO/IEC 9075-14:2003 (E)


This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

This page intentionally left blank.

2 XML-Related Specifications (SQL/XML) ©ISO/IEC 2003 – All rights reserved

www.standards.com.au © Standards Australia


This is a free preview. Purchase the entire publication at the link below:

AS ISO/IEC 9075.14-2005, Information technology -


Database languages - SQL XML-Related
Specifications (SQL/XML)
This is a free 14 page sample. Access the full version at http://infostore.saiglobal.com.

Looking for additional Standards? Visit SAI Global Infostore


Subscribe to our Free Newsletters about Australian Standards® in Legislation; ISO, IEC, BSI and more
Do you need to Manage Standards Collections Online?
Learn about LexConnect, All Jurisdictions, Standards referenced in Australian legislation
Do you want to know when a Standard has changed?
Want to become an SAI Global Standards Sales Affiliate?

Learn about other SAI Global Services:

LOGICOM Military Parts and Supplier Database


Metals Infobase Database of Metal Grades, Standards and Manufacturers
Materials Infobase Database of Materials, Standards and Suppliers
Database of European Law, CELEX and Court Decisions

Need to speak with a Customer Service Representative - Contact Us

Você também pode gostar