SQL Reference
The rules for forming a name depend on the type of the object designated by
the name. Database object names may be made up of a single identifier
or they may be schema qualified objects made up of two identifiers.
Schema qualified object names may be specified without the schema name.
In such cases, a schema name is implicit.
In dynamic SQL statements, a schema qualified object name implicitly uses
the CURRENT SCHEMA special register value as the qualifier for unqualified
object name references. By default it is set to the current
authorization ID. See SET SCHEMA for details. If the dynamic SQL statement is from a
package bound with the DYNAMICRULES BIND option, the CURRENT SCHEMA special
register is not used in qualification. In a DYNAMICRULES BIND package,
the package default qualifier is used as the value for qualification of
unqualified object references within dynamic SQL statements.
In static SQL statements, the QUALIFIER precompile/bind option implicitly
specifies the qualifier for unqualified database object names. By
default, it is set to the package authorization ID. See the Command Reference for details.
The syntax diagrams use different terms for different types of
names. The following list defines these terms. For maximum
length of various identifiers refer to Appendix A, SQL Limits.
- alias-name
- A schema qualified name that designates an alias.
- attribute-name
- An identifier that designates an attribute of a structured data
type.
- authorization-name
- An identifier that designates a user or group. Note the following
restrictions on the characters that can be used:
- Valid characters are A through Z, a through z, 0 through 9, #, @, $ and
_.
- The name must not begin with the characters 'SYS', 'IBM'
or 'SQL'.
- The name must not be: ADMINS, GUESTS, LOCAL, PUBLIC, or
USERS.
- A delimited authorization ID must not contain lowercase letters.
- bufferpool-name
- An identifier that designates a bufferpool.
- column-name
- A qualified or unqualified name that designates a column of a table or
view. The qualifier is a table-name, a view-name, a nickname, or a
correlation-name.
- condition-name
- An identifier that designates a condition in an SQL procedure.
- constraint-name
- An identifier that designates a referential constraint, primary key
constraint, unique constraint or a table check constraint.
- correlation-name
- An identifier that designates a result table.
- cursor-name
- An identifier that designates an SQL cursor. For host
compatibility, a hyphen character may be used in the name.
- data-source-name
- A identifier that designates a data source. This identifier is the
first of the three parts of remote-object-name.
- descriptor-name
- A colon followed by a host identifier that designates an SQL descriptor
area (SQLDA). See References to Host Variables for a description of a host identifier. Note that a
descriptor-name never includes an indicator variable.
- distinct-type-name
- A qualified or unqualified name that designates a distinct
type-name. An unqualified distinct-type-name in an SQL statement is
implicitly qualified by the database manager, depending on context.
- event-monitor-name
- An identifier that designates an event monitor.
- function-mapping-name
- An identifier that designates a function mapping.
- function-name
- A qualified or unqualified name that designates a function. A
unqualified function-name in an SQL statement is implicitly qualified by the
database manager, depending on context.
- group-name
- An unqualified identifier that designates a transform group defined for a
structured type.
- host-variable
- A sequence of tokens that designates a host variable. A host
variable includes at least one host identifier, as explained in References to Host Variables.
- index-name
- A schema qualified name that designates an index or an index
specification.
- label
- An identifier that designates a label in an SQL procedure.
- method-name
- An identifier that designates a method. The schema context for a
method is determined by the schema of the subject type (or a supertype of the
subject type) of the method.
- nickname
- A schema qualified name that designates a federated server reference to a
table or view.
- nodegroup-name
- An identifier that designates a nodegroup.
- package-name
- A schema qualified name that designates a package.
- parameter-name
- An identifier that names a parameter that can be referenced in a
procedure, user-defined function, method, or index extension.
- procedure-name
- A qualified or unqualified name that designates a procedure. An
unqualified procedure-name in an SQL statement is implicitly qualified by the
database manager, depending on context.
- remote-authorization-name
- An identifier that designates a data source user. The rules for
authorization names vary from data source to data source.
- remote-function-name
- A name that designates a function registered to a data source
database.
- remote-object-name
- A three-part name that designates a data source table or view and that
identifies the data source where the table or view resides. The parts
in this name are data-source-name, remote-schema-name, and
remote-table-name.
- remote-schema-name
- A name that designates the schema that a data source table or view
belongs. This name is the second of the three parts of
remote-object-name.
- remote-table-name
- A name that designates a table or view at a data source. This name
is the third of the three parts of remote-object-name.
- remote-type-name
- A data type supported by a data source database. Do not use the
long form for system built-in types (for example, use CHAR instead of
CHARACTER).
- savepoint-name
- An identifier that designates a savepoint.
- schema-name
- An identifier that provides a logical grouping for SQL objects. A
schema-name used as a qualifier of the name of an object may be implicitly
determined:
- from the value of the CURRENT SCHEMA special register
- from the value of the QUALIFIER precompile/bind option
- based on a resolution algorithm that uses the CURRENT PATH special
register
- based on the schema name of another object in the same SQL
statement.
To avoid complications, it is recommended that the schema name "SESSION"
not be used as a schema, except as the schema for declared global temporary
tables (which must use the schema name "SESSION").
- server-name
- An identifier that designates an application server. In a federated
system, server-name also designates the local name of a data source.
- specific-name
- A qualified or unqualified name that designates a specific name. An
unqualified specific-name in an SQL statement is implicitly qualified by the
database manager, depending on context.
- SQL-variable-name
- Defines the name of a local variable in an SQL procedure statement.
SQL-variable-names can be used in other SQL statements where a host-variable
name is allowed. The name can be qualified by the label of the compound
statement that declared the SQL variable.
- statement-name
- An identifier that designates a prepared SQL statement.
- supertype-name
- A qualified or unqualified name that designates the supertype of a
type-name. An unqualified supertype-name in an SQL statement is
implicitly qualified by the database manager, depending on context.
- table-name
- A schema qualified name that designates a table.
- tablespace-name
- An identifier that designates a table space.
- trigger-name
- A schema qualified name that designates a trigger.
- type-mapping-name
- An identifier that designates a data type mapping.
- type-name
- A qualified or unqualified name that designates a type-name. An
unqualified type-name in an SQL statement is implicitly qualified by the
database manager, depending on context.
- typed-table-name
- A schema qualified name that designates a typed table.
- typed-view-name
- A schema qualified name that designates a typed view.
- view-name
- A schema qualified name that designates a view.
- wrapper-name
- An identifier that designates a wrapper.
[ Top of Page | Previous Page | Next Page ]