Naming conventions

The rules for forming a name depend on the type of the object designated by the name.

The syntax diagrams use different terms for different types of names. The following list defines these terms.
Start of changeaccelerator-nameEnd of change
Start of changeAn unqualified name that identifies an accelerator-only table. An accelerator name is 1 to 8 uppercase characters or digits. The name must be unique within the DB2® subsystem or data sharing group.End of change
alias-name
A qualified or unqualified name that designates an alias, table, or view. The unqualified form of alias-name is an SQL identifier. An unqualified alias-name in an SQL statement is implicitly qualified by the default schema. The qualified form is a schema-name followed by a period and an SQL identifier.

See Aliases and synonyms for additional information about aliases.

authorization-name
An SQL identifier that designates a set of privileges. It can also designate a user, a group of users, or a role. For a user or a group of users, DB2 does not control this property. For a role, DB2 does control this property. See Authorization IDs, roles, and authorization names for the distinction between an authorization name and an authorization ID.
aux-table-name
A qualified or unqualified name that designates an auxiliary table. The rules for the name are the same as the rules for table-name. See table-name.
bpname
A name that identifies a buffer pool. The following list shows the names of the different buffer pool sizes.
4KB
BP0, BP1, BP2, …, BP49
8KB
BP8K0, BP8K1, BP8K2, …, BP8K9
16KB
BP16K0, BP16K1, BP16K2, …, BP16K9
32KB
BP32K, BP32K1, BP32K2, …, BP32K9
built-in-type
A qualified or unqualified name that identifies an IBM®-supplied data type. A qualified name is SYSIBM followed by a period and the name of the built-in data type. An unqualified name has an implicit qualifier, the schema name, which is determined by the rules in Qualification of unqualified object names.
catalog-name
An SQL identifier that designates an integrated catalog facility catalog. The identifier must start with a letter and must not include special characters.
clone-table-name
A qualified or unqualified name that designates the name of a clone table. See the definition of table-name for more information about qualification of table names.
collection-id
An SQL identifier that identifies a collection of packages, such as a collection ID as a qualifier for a package ID. See Naming conventions.
column-name
A qualified or unqualified name that designates a column of a table or view.

A qualified column name is a qualifier followed by a period and an SQL identifier. The qualifier is a table name, a view name, a synonym, an alias, or a correlation name. The unqualified column name is an SQL identifier.

constraint-name
An SQL identifier that designates a primary key, check, referential, or unique constraint on a table.
correlation-name
An SQL identifier that designates a table, a view, or individual rows of a table or view.
context-name
An unqualified SQL identifier that designates a trusted context.
cursor-name
An SQL identifier that designates an SQL cursor. In SQLJ, cursor-name is a host variable (with no indicator variable) that identifies an instance of an iterator.
database-name
An SQL identifier that designates a database. The identifier must start with a letter and must not include special characters.
descriptor-name
A host identifier that designates an SQL descriptor area (SQLDA). See Host variables for a description of a host identifier. A descriptor name never includes an indicator variable.
distinct-type-name
A qualified or unqualified name that designates a distinct type.

A qualified distinct type name is a two-part name. The first part is the schema name of the distinct type. The second part is an SQL identifier. A period must separate each of the parts.

An unqualified distinct type name is an SQL identifier with an implicit qualifier. The implicit qualifier is the schema name, which is determined by the context in which the distinct type appears as described by the rules in Unqualified distinct type, function, procedure, and specific names.

external-program-name
A name that specifies the program that runs when the function is invoked or the procedure name is specified in a CALL statement.
function-name
A qualified or unqualified name that designates a user-defined function, a cast function that was generated when a distinct type was created, or a built-in function.

A qualified function name is a two-part name. The first part is the schema name of the function. The second part is an SQL identifier. A period must separate each of the parts.

An unqualified function name is an SQL identifier with an implicit qualifier. The implicit qualifier is the schema name, which is determined by the context in which the unqualified name appears as described by the rules in Unqualified distinct type, function, procedure, and specific names.

host-label
A token that designates a label in a host program.
host-variable
A sequence of tokens that designates a host variable. A host variable includes at least one host identifier, as explained in Host variables.
index-name
A qualified or unqualified name that designates an index.

A qualified index name is an authorization ID or schema name followed by a period and an SQL identifier.

An unqualified index name is an SQL identifier with an implicit qualifier. The implicit qualifier is an authorization ID, which is determined by the context in which the unqualified name appears as described by the rules in Qualification of unqualified object names.

For an index on a declared temporary table, the qualifier must be SESSION.

location-name
An SQL identifier that designates the name of a location. A location name is 1 to 16 bytes, does not include alphabetic extenders, lowercase letters, or Katakana characters. The characters allowed in the delimited form are the same as those allowed in the ordinary form.
Start of changemask-nameEnd of change
Start of changeA qualified or unqualified name that designates a mask.

A qualified mask name is a two-part name. The first part is the schema name. The second part is an SQL identifier. A period must separate each of the parts.

A one-part or unqualified mask name is an SQL identifier with an implicit qualifier. The implicit qualifier is an authorization ID, which is determined by the context in which the unqualified name appears as described by the rules in Qualification of unqualified object names.

End of change
package-name
A qualified or unqualified name that designates a package. The unqualified form of a package-name is an SQL identifier. A package-name must not be a delimited identifier that includes lowercase letters or special characters. A package-name in an SQL statement must be qualified. In some contexts outside of SQL, a package name can be specified as an unqualified name.
parameter-name
Start of changeAn SQL identifier that designates a parameter in an SQL procedure or SQL function. End of change
Start of changepermission-nameEnd of change
Start of changeA qualified or unqualified name that designates a permission.

A qualified permission name is a two-part name. The first part is the schema name. The second part is an SQL identifier. A period must separate each of the parts.

A one-part or unqualified permission name is an SQL identifier with an implicit qualifier. The implicit qualifier is an authorization ID, which is determined by the context in which the unqualified name appears as described by the rules in Qualification of unqualified object names.

End of change
plan-name
An SQL identifier that designates an application plan. The identifier must not be a delimited identifier that includes lowercase letters or special characters.
procedure-name
A qualified or unqualified name that designates a stored procedure.

A fully qualified procedure name is a three-part name. The first part is a location name that identifies the DBMS at which the procedure is stored. The second part is the schema name of the stored procedure. The third part is an SQL identifier. A period must separate each of the parts in a qualified name.

A two-part procedure name is implicitly qualified with the location name of the current server. The first part is the schema name of the stored procedure. The second part is an SQL identifier. A period must separate the two parts.

A one part, or unqualified, procedure name is an SQL identifier with two implicit qualifiers. The first implicit qualifier is the location name of the current server. The second implicit qualifier is the schema name, which is determined by the context in which the unqualified name appears, as described by the rules in Qualification of unqualified object names.

The SQL identifier in a qualified or unqualified name must not be an asterisk (*).

profile-name
An SQL identifier that corresponds to a RACF® profile name.
program-name
An SQL identifier that designates an exit routine.
role-name
Start of changeAn unqualified SQL identifier that designates a role. The identifier cannot begin with the characters SYS and cannot be ACCESSCTRL, DATAACCESS, DBADM, DBCTRL, DBMAINT, NONE, NULL, PACKADM, PUBLIC, SECADM, or SQLADM.End of change
routine-version-id
An SQL identifier of up to 64 EBCDIC bytes that designates a version of a routine. The UTF-8 representation of the identifier must not exceed 122 bytes.
savepoint-name
An unqualified SQL identifier that designates a savepoint.
schema-name
An SQL identifier that provides a logical grouping for SQL objects. A schema-name is used as a qualifier of the name of SQL objects.
seclabel-name
Start of changeA string that corresponds to the value of the RACF security label. It is recommended that name not include national characters (@ (X'7C'), # (X'7B'), or $ (X'5B')). If the table is a Unicode table and the security label name does include national characters, an error might be issued if substitution occurs when DB2 converts the value from EBCDIC to Unicode.End of change
sequence-name
A qualified or unqualified name that designates a sequence.

A qualified sequence name is a two-part name. The first part is the schema name. The second part is an SQL identifier. A period must separate each of the parts.

A one-part or unqualified sequence name is an SQL identifier with an implicit qualifier. The implicit qualifier is an authorization ID, which is determined by the context in which the unqualified name appears as described by the rules in Unqualified alias, index, JAR file, sequence, table, trigger, and view names.

server-name
An SQL identifier that designates an application server. The identifier must start with a letter and must not include lowercase letters or special characters.
specific-name
A qualified or unqualified name that designates a unique name for a user-defined function.

A qualified specific name is a two-part name. The first part is the schema name. The second part is an SQL identifier, and it must not be an asterisk (*). A period must separate each of the parts.

An unqualified specific name is an SQL identifier with an implicit qualifier. The implicit qualifier is the schema name, which is determined by the context in which the unqualified name appears as described by the rules in Unqualified distinct type, function, procedure, and specific names.

A specific name can be used to identify a function to alter, comment on, drop, grant privileges on, revoke privileges from, or be the source function for another function. A specific name cannot be used to invoke a function. In addition to being used in certain SQL statements, a specific name must be used in DB2 commands to uniquely identify a function.

SQL-condition-name
Start of changeAn SQL identifier that designates a condition in an SQL function or an SQL procedure.End of change
SQL-label
Start of changeAn SQL identifier that designates a label in an SQL function or an SQL procedure.End of change
SQL-parameter-name
Start of changeA qualified or unqualified name that designates a parameter in the SQL routine body of an SQL function or SQL procedure. The unqualified form of an SQL-parameter-name is an SQL identifier. The qualified form is a function-name or procedure-name followed by a period and an SQL identifier.End of change
SQL-variable-name
Start of changeA qualified or unqualified name that designates a variable in an SQL routine body. The unqualified form of an SQL-variable-name is an SQL identifier. The qualified form is an SQL-label followed by a period (.) and an SQL identifier.End of change
statement-name
An SQL identifier that designates a prepared SQL statement.
stogroup-name
An SQL identifier that designates a storage group.
synonym
An SQL identifier that designates a synonym, a table, or a view. The table or view must exist at the current server. A qualified name is never interpreted as a synonym.

See Aliases and synonyms for additional information about synonyms.

table-name
A qualified or unqualified name that designates a table.

A fully qualified table name is a three-part name. The first part is a location name that designates the DBMS at which the table is stored. The second part is a schema name. The third part is an SQL identifier. A period must separate each of the parts.

A two-part table name is implicitly qualified by the location name of the current server. The first part is a schema name. The second part is an SQL identifier. A period must separate the two parts.

A one-part or unqualified table name is an SQL identifier with two implicit qualifiers. The first implicit qualifier is the location name of the current server. The second is a schema name, which is determined by the rules set forth in Unqualified alias, index, JAR file, sequence, table, trigger, and view names. For a declared temporary table, the qualifier (the second part in a three-part name and the first part in a two-part name) must be SESSION. For complete details on specifying a name when a declared temporary table is defined and then later referring to that declared temporary table in other SQL statements, see DECLARE GLOBAL TEMPORARY TABLE.

table-space-name
An SQL identifier that designates a table space of an identified database. The identifier must start with a letter and must not include special characters. If a database is not identified, DSNDB04 is implicit.
trigger-name
A qualified or unqualified name that designates a trigger.

A qualified trigger name is a two-part name. The first part is the schema name of the trigger. The second part is an SQL identifier. A period must separate each of the parts.

An unqualified trigger name is an SQL identifier with an implicit qualifier. The implicit qualifier is the schema name, which is determined by the context in which the unqualified name appears as described by the rules in Unqualified alias, index, JAR file, sequence, table, trigger, and view names.

view-name
A qualified or unqualified name that designates a view.

A fully qualified view name is a three-part name. The first part is a location name that designates the DBMS where the view is defined. The second part is a schema name. The third part is an SQL identifier. A period must separate each of the parts.

A two-part view name is implicitly qualified by the location name of the current server. The first part is a schema name. The second part is an SQL identifier. A period must separate the two parts.

A one-part or unqualified view name is an SQL identifier with two implicit qualifiers. The first implicit qualifier is the location name of the current server. The second is a schema name, which is determined by the context in which the unqualified name appears as described by the rules in Unqualified alias, index, JAR file, sequence, table, trigger, and view names.

XML-attribute-name
An identifier that is used as an XML attribute name.
XML-element-name
An identifier that is used as an XML element name.