IB M
®
DB2
Universal
Database
™
SQL
Reference
Volu me
1
Ve r s i o n
8.2
SC09-4844-01
IB M
®
DB2
Universal
Database
™
SQL
Reference
Volu me
1
Ve r s i o n
8.2
SC09-4844-01
Before
using
this
information
and
the
product
it
supports,
be
sure
to
read
the
general
information
under
Notices.
This
document
contains
proprietary
information
of
IBM.
It
is
provided
under
a
license
agreement
and
is
protected
by
copyright
law.
The
information
contained
in
this
publication
does
not
include
any
product
warranties,
and
any
statements
provided
in
this
manual
should
not
be
interpreted
as
such.
You
can
order
IBM
publications
online
or
through
your
local
IBM
representative.
v
To
order
publications
online,
go
to
the
IBM
Publications
Center
at
www.ibm.com/shop/publications/order
v
To
find
your
local
IBM
representative,
go
to
the
IBM
Directory
of
Worldwide
Contacts
at
www.ibm.com/planetwide
To
order
DB2
publications
from
DB2
Marketing
and
Sales
in
the
United
States
or
Canada,
call
1-800-IBM-4YOU
(426-4968).
When
you
send
information
to
IBM,
you
grant
IBM
a
nonexclusive
right
to
use
or
distribute
the
information
in
any
way
it
believes
appropriate
without
incurring
any
obligation
to
you.
©
Copyright
International
Business
Machines
Corporation
1993
-
2004.
All
rights
reserved.
US
Government
Users
Restricted
Rights
–
Use,
duplication
or
disclosure
restricted
by
GSA
ADP
Schedule
Contract
with
IBM
Corp.
Contents
About
this
book
.
.
.
.
.
.
.
.
.
.
.ix
Who
should
use
this
book
.
.
.
.
.
.
.
.
.ix
How
this
book
is
structured
.
.
.
.
.
.
.
.
.ix
A
brief
overview
of
Volume
2
.
.
.
.
.
.
.
.x
How
to
read
the
syntax
diagrams
.
.
.
.
.
.
.x
Common
syntax
elements
.
.
.
.
.
.
.
.
. xii
Function
designator
.
.
.
.
.
.
.
.
.
. xii
Method
designator
.
.
.
.
.
.
.
.
.
. xiii
Procedure
designator
.
.
.
.
.
.
.
.
.
.xv
Conventions
used
in
this
manual
.
.
.
.
.
.
. xvi
Error
conditions
.
.
.
.
.
.
.
.
.
.
. xvi
Highlighting
conventions
.
.
.
.
.
.
.
. xvi
Related
documentation
.
.
.
.
.
.
.
.
.
. xvii
Chapter
1.
Concepts
.
.
.
.
.
.
.
.
.1
Relational
databases
.
.
.
.
.
.
.
.
.
.
.
.1
Structured
Query
Language
(SQL)
.
.
.
.
.
.
.1
Privileges,
authority
levels,
and
database
authorities
1
Schemas
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.5
Tables
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.6
Views
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.7
Aliases
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.7
Indexes
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.8
Keys
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.8
Constraints
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.8
Unique
constraints
.
.
.
.
.
.
.
.
.
.
.9
Referential
constraints
.
.
.
.
.
.
.
.
.
.9
Table
check
constraints
.
.
.
.
.
.
.
.
.12
Informational
constraints
.
.
.
.
.
.
.
.
.13
Isolation
levels
.
.
.
.
.
.
.
.
.
.
.
.
.13
Comparison
of
isolation
levels
.
.
.
.
.
.
.15
Queries
and
table
expressions
.
.
.
.
.
.
.
.16
Application
processes,
concurrency,
and
recovery
.
.16
DB2
Call
level
interface
(CLI)
and
open
database
connectivity
(ODBC)
.
.
.
.
.
.
.
.
.
.
.18
Java
database
connectivity
(JDBC)
and
embedded
SQL
for
Java
(SQLJ)
programs
.
.
.
.
.
.
.
.19
Packages
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.19
Catalog
views
.
.
.
.
.
.
.
.
.
.
.
.
.19
Character
conversion
.
.
.
.
.
.
.
.
.
.
.20
Event
monitors
.
.
.
.
.
.
.
.
.
.
.
.
.22
Triggers
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.23
Table
spaces
and
other
storage
structures
.
.
.
.24
Data
partitioning
across
multiple
partitions
.
.
.
.26
Distributed
relational
databases
.
.
.
.
.
.
.
.27
Remote
unit
of
work
.
.
.
.
.
.
.
.
.
.28
Application-directed
distributed
unit
of
work
.
.31
Data
representation
considerations
.
.
.
.
.
.35
DB2
federated
systems
.
.
.
.
.
.
.
.
.
.35
Federated
systems
.
.
.
.
.
.
.
.
.
.
.35
The
federated
server
.
.
.
.
.
.
.
.
.
.36
What
is
a
data
source?
.
.
.
.
.
.
.
.
.
.37
Supported
data
sources
.
.
.
.
.
.
.
.
.37
The
federated
database
.
.
.
.
.
.
.
.
.39
The
federated
database
system
catalog
.
.
.
.40
The
SQL
Compiler
.
.
.
.
.
.
.
.
.
.
.41
The
query
optimizer
.
.
.
.
.
.
.
.
.
.41
Compensation
.
.
.
.
.
.
.
.
.
.
.
.42
Pass-through
sessions
.
.
.
.
.
.
.
.
.
.43
Wrappers
and
wrapper
modules
.
.
.
.
.
.44
Default
wrapper
names
.
.
.
.
.
.
.
.
.45
Server
definitions
and
server
options
.
.
.
.
.46
User
mappings
.
.
.
.
.
.
.
.
.
.
.
.46
Nicknames
and
data
source
objects
.
.
.
.
.47
Valid
data
source
objects
.
.
.
.
.
.
.
.
.47
Nickname
column
options
.
.
.
.
.
.
.
.48
Data
type
mappings
.
.
.
.
.
.
.
.
.
.49
Function
mappings
.
.
.
.
.
.
.
.
.
.
.50
Index
specifications
.
.
.
.
.
.
.
.
.
.
.50
Collating
sequences
.
.
.
.
.
.
.
.
.
.
.51
Chapter
2.
Language
elements
.
.
.
.55
Characters
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.55
Tokens
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.57
Identifiers
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.58
Naming
conventions
and
implicit
object
name
qualifications
.
.
.
.
.
.
.
.
.
.
.
.
.58
Aliases
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.62
Authorization
IDs
and
authorization
names
.
.63
Column
names
.
.
.
.
.
.
.
.
.
.
.
.66
References
to
host
variables
.
.
.
.
.
.
.
.72
Data
types
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.79
Data
types
.
.
.
.
.
.
.
.
.
.
.
.
.
.79
Numbers
.
.
.
.
.
.
.
.
.
.
.
.
.
.80
Character
strings
.
.
.
.
.
.
.
.
.
.
.81
Graphic
strings
.
.
.
.
.
.
.
.
.
.
.
.82
Binary
strings
.
.
.
.
.
.
.
.
.
.
.
.83
Large
objects
(LOBs)
.
.
.
.
.
.
.
.
.
.84
Datetime
values
.
.
.
.
.
.
.
.
.
.
.
.85
DATALINK
values
.
.
.
.
.
.
.
.
.
.
.88
XML
values
.
.
.
.
.
.
.
.
.
.
.
.
.90
User-defined
types
.
.
.
.
.
.
.
.
.
.
.91
Promotion
of
data
types
.
.
.
.
.
.
.
.
.94
Casting
between
data
types
.
.
.
.
.
.
.
.96
Assignments
and
comparisons
.
.
.
.
.
.
.99
Rules
for
result
data
types
.
.
.
.
.
.
.
.113
Rules
for
string
conversions
.
.
.
.
.
.
.117
Partition-compatible
data
types
.
.
.
.
.
.119
Constants
.
.
.
.
.
.
.
.
.
.
.
.
.
. 121
Integer
constants
.
.
.
.
.
.
.
.
.
.
. 121
Floating-point
constants
.
.
.
.
.
.
.
.
. 121
Decimal
constants
.
.
.
.
.
.
.
.
.
.
. 122
Character
string
constants
.
.
.
.
.
.
.
. 122
Hexadecimal
constants
.
.
.
.
.
.
.
.
. 122
Graphic
string
constants
.
.
.
.
.
.
.
.
. 123
Special
registers
.
.
.
.
.
.
.
.
.
.
.
. 124
Special
registers
.
.
.
.
.
.
.
.
.
.
. 124
CURRENT
CLIENT_ACCTNG
.
.
.
.
.
. 126
CURRENT
CLIENT_APPLNAME
.
.
.
.
. 127
CURRENT
CLIENT_USERID
.
.
.
.
.
.
. 128
©
Copyright
IBM
Corp.
1993
-
2004
iii
||
|
|
|
|