The rules for forming a name depend on the type of the object designated by the name and the naming option (*SQL or *SYS). The naming option is specified on the CRTSQLxxx, RUNSQLSTM, and STRSQL commands. The SET OPTION statement can be used to specify the naming option within the source of a program containing embedded SQL. The syntax diagrams use different terms for different types of names. The following list defines these terms.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
An alias-name can specify either the name of the alias or the system object name of the alias.
For SQL names, the unqualified collection name in an SQL statement is implicitly qualified by the server-name. The qualified form is a server-name followed by a (.) and a system identifier. The server-name must identify the current server.
For system names, the unqualified collection name in an SQL statement is implicitly qualified by the server-name. The qualified form is a server-name followed by a slash (/) and a system identifier. The server-name must identify the current server.
| Note: | Collection-name refers to either a collection created by the CREATE COLLECTION or CREATE SCHEMA statement or to an OS/400 library. |
Column names cannot be qualified with system names in the form collection-name/table-name.column-name, except in the COMMENT ON and LABEL ON statements. If column names need to be qualified, and correlation names are allowed in the statement, a correlation name must be used to qualify the column.
A column-name can specify either the column name or the system column name of a column of a table or view.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
The unqualified form is a system identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
The format of the character string form is either:
The class-id identifies the class identifier of the Java object. If the class is part of a package, the class identifier must include the complete package prefix. For example, if the class identifier is 'myPackage.StoredProcs', the Java Virtual machine will look in the following directory for the StoredProcs class:
'/QIBM/ProdData/OS400/SQLLib/
Function/myPackage/StoredProcs/'
The method-id identifies the method name of the Java object to be invoked.
This form is only valid for Java Procedures.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
For system naming, functions names can only be qualified in the form collection-name/function-name when the name is used in a CREATE, COMMENT ON, DROP, GRANT, or REVOKE statement.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
The qualified form of a nodegroup-name depends on the naming option. For SQL naming, the qualified form is a collection-name followed by a period (.) and a system identifier. For system naming, the qualified form is a collection-name followed by a slash (/) followed by a system identifier.
The unqualified form is a system identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
The unqualified form is a system identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
If the unqualified name of the table, view, index, or alias is a valid system identifier, the system-object-name of the table, view, index, or alias is the unqualified name of the table, view, index, or alias.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
A table-name can specify either the name of the table or the system object name of the table.
The unqualified form is an SQL identifier. The unqualified form is implicitly qualified based on the rules specified in Qualification of Unqualified Object Names.
A view-name can specify either the name of the view or the system object
name of the view.
Table 2. Identifier Length Limits (in bytes)
| Identifier Type | Maximum Length |
|---|---|
| Alias name | 128 |
| Authorization name | 10 |
| Correlation name | 128 |
| Cursor name | 18 |
| Host identifier | 64 |
| Server name | 18 |
| SQL label | 64 |
| Statement name | 18 |
| Unqualified collection name | 10 |
| Unqualified column name | 30 |
| Unqualified constraint name | 128 |
| Unqualified data type name | 128 |
| Unqualified external program name 12 | 10 |
| Unqualified function name | 128 |
| Unqualified nodegroup name | 10 |
| Unqualified package name | 10 |
| Unqualified parameter name | 128 |
| Unqualified procedure name | 128 |
| Unqualified specific name | 128 |
| Unqualified SQL parameter name | 64 |
| Unqualified SQL variable name | 64 |
| Unqualified system column name | 10 |
| Unqualified system object name | 10 |
| Unqualified table, view, and index name | 128 |
Unqualified object names are implicitly qualified. The rules for qualifying a name differ depending on the type of object that the name identifies.
Unqualified alias, constraint, external program, index, nodegroup, package, table, and view names are implicitly qualified as follows:
Table 3. Default Collection Interfaces
| SQL Interface | Specification |
|---|---|
| Embedded SQL | DFTRDBCOL parameter and DYNDFTCOL(*YES) on the CRTSQLxxx commands.
The SET OPTION statement can also be used to set the DFTRDBCOL and DYNDFTCOL
values.
(For more information on CRTSQLxxx commands, see the SQL Programming with Host Languages book.) |
| Call Level Interface (CLI) on the server | SQL_ATTR_DEFAULT_LIB environment or connection variable
(For more information on CLI, see the SQL Call Level Interfaces (ODBC) book.) |
| JDBC or SQLJ on the server using AS/400 Developer Kit for Java | libraries property object
(For more information on JDBC and SQLJ, see the Java topic in the AS/400e Information Center, SK3T-2027-02.) |
| ODBC on a client using the Client Access ODBC Driver | Default Libraries List in ODBC Setup
(For more information on ODBC, see the Client Access Express category in the AS/400 Information Center.) |
| JDBC on a client using the AS/400 Toolbox for Java | Default Libraries List in ODBC Setup
(For more information on ODBC, see the
Client Access Express
category in the AS/400 Information Center.)
(For more information on the AS/400 Toolbox for Java, see the Java topic in the AS/400e Information Center, SK3T-2027-02.) |
The qualification of data type (both built-in and distinct type), function, procedure, and specific names depends on the SQL statement in which the unqualified name appears:
The CL command Override Database File (OVRDBF) can be specified to override an SQL or system name with another object name for local data manipulation SQL statements. Overrides are ignored for data definition SQL statements and data manipulation SQL statements executing at a remote relational database. See the File Management book for more information about the override function.