Previous Topic: Delimited SQL identifiersNext Topic: Authorization ID


Naming Conventions

The rules for forming a name depend on the type of object designated by the name. Syntax diagrams for SQL language elements and statements use different terms for different types of names. Following are terms used in the syntax diagrams.

accessor-id

An SQL identifier that designates a user. Accessor IDs must be 1 to 18 characters.

authorization-id (AUTHID)

An SQL identifier that designates a schema. Authorization IDs must be 1 to 18 characters.

The SQL name and the AUTHORIZATION occurrence name are the same and must be unique for all schemas.

column-name

A name that designates a column of a table or view. The name can be unqualified or qualified. If you specify ANSI or FIPS for SQLMODE= in the SQL Preprocessor options, the unqualified form of a column name is an SQL identifier, 1 to 18 characters. For all other modes, the unqualified form of a column name can be 1 to 32 characters. The qualified form of a column name is a qualifier followed by a period and the column name. The qualifier is a table-name, a view-name or a correlation-name.

correlation-name

An SQL identifier that designates a table, a view, or individual rows of a table or view. If you specify ANSI or FIPS for SQLMODE= in the SQL Preprocessor options, the correlation name can be 1 to 18 characters. For all other modes, the correlation name can be 1 to 32 characters. Also see Correlation Names and SQL Index Binding.

cursor-name

An SQL identifier that designates an SQL cursor. If you specify ANSI or FIPS for SQLMODE= in the SQL Preprocessor options, the cursor name can be 1 to 18 characters. For all other modes, the cursor name can be 1 to 32 characters.

descriptor-name

A host identifier that designates an SQL Descriptor Area (SQLDA). The host identifier may be preceeded by a colon. For more information on the SQLDA, see SQL Descriptor Area (SQLDA). For more information on host identifiers, see Host Variables.

host-variable

A sequence of tokens that designate one or more host variables. The host variable includes an identifier (see Host Variables).

index-name

A name that designates an index. The name can be qualified or unqualified. The unqualified index name in an SQL statement is implicitly qualified by the authorization ID of that statement. If you specify ANSI or FIPS for SQLMODE= in the SQL Preprocessor options, the unqualified form of an index name is an SQL identifier, 1 to 18 characters. For all other modes, the unqualified form of an index name can be 1 to 32 characters in length. The qualified form of an index name is an authorization ID followed by a period and the index name.

The SQL name of the index must be unique for all indexes owned by a specific schema (authorization ID). See Naming the Index (Key) for more information on naming an index.

statement-name

An identifier (1 to 18 characters) that designates a prepared SQL statement.

procedure name

The procedure name is the name that identifies a procedure. The name can be qualified with an authorization ID.

SQL parameter name

The SQL parameter name is the name of a parameter passed to an SQL Procedure (a LANGUAGE SQL procedure). When used in a SQL Procedure containing an SQL variable with a conflicting (matching) name, or a table or view reference where the table or view contains a conflicting column name, the name should be qualified using the procedure name.

SQL variable name

The SQL variable name is the name of a variable that is declared within a compound statement inside a SQL Procedure (a LANGUAGE SQL procedure). If the name conflicts with (matches) another SQL variable name (for example, from a nested compound statement such as a condition handler), an SQL parameter name, or a column contained within a referenced table or view, the SQL variable name should be qualified using the start-label of the compound statement that immediately contains it.

synonym

An SQL identifier that designates a table or a view. A synonym can be used wherever a table-name or view-name can be used to reference a table or view. If you specify ANSI or FIPS for SQLMODE= in the SQL Preprocessor options, the synonym name is an SQL identifier, 1 to 18 characters. For all other modes, the synonym name can be 1 to 32 characters.

The SQL name of the synonym must be unique for all tables, views, and synonyms owned by a specific schema (authorization ID). See Naming the Synonym for more information on naming a synonym.

table-name

A name that designates a table. The name can be qualified or unqualified. The unqualified table name in an SQL statement is implicitly qualified by the authorization ID of that statement. If you specify ANSI or FIPS for SQLMODE= in the SQL Preprocessor options, the unqualified form of a table name is an SQL identifier, 1 to 18 characters. For all other modes, the unqualified form of a table name can be 1 to 32 characters in length. The qualified form of a table name is an authorization ID followed by a period and the table name.

The SQL name of the table must be unique for all indexes, views and synonyms owned by a specific schema (authorization ID). See Naming the Table for more information on naming a table.

view-name

A name that designates a view. The name can be qualified or unqualified. The unqualified view name in an SQL statement is implicitly qualified by the authorization ID of that statement. If you specify ANSI or FIPS for SQLMODE= in the SQL Preprocessor options, the unqualified form of a view name is an SQL identifier, 1 to 18 characters. For all other modes, the unqualified form of a view name can be 1 to 32 characters. The qualified form of a view name is an authorization ID followed by a period and the view name.

The SQL name of the view must be unique for all tables, views and synonyms owned by a specific schema (authorization ID). See Naming the View for more information on naming a view.

Note: See the chapter on the SQL transport utility (DDTRSLM) in the CA Datacom Datadictionary Batch Reference Guide for information about additional restrictions on words used for an AUTHID, SQL name, or CA Datacom Datadictionary occurrence name.

When you create SQL tables, views and synonyms, the SQL name is prefixed by the authorization ID to create the TABLE, VIEW and SYNONYM occurrence name. The format is authid-sqlname.

Together, the authorization ID and SQL name of each table, view and synonym must be unique within the schema. For example, the names JONES.DEPTTBL (for a table) and JONES.DEPTTBL (for a view) are not unique since both are owned by the JONES schema, but the names JONES.DEPTTBL (for a table) and SMITH.DEPTTBL (for a view) are unique because they are owned by different schemas.