Previous Topic: Expansion of Joined-tableNext Topic: Expansion of Cursor-name


Identifying Entities in Schemas

Access modules, referential constraints, tables, views, table procedures, procedures, and user-defined functions are all associated with schemas. However, when you name one of these entities in an SQL statement, specification of the schema name is optional. The schema CA IDMS uses when processing the statement depends on the following:

Resolving References to Entities in Schemas

Interactive and dynamic SQL

When compiling a statement using interactive or dynamic SQL, or when using the EXPLAIN statement to determine the access strategy to be used for an SQL statement, CA IDMS resolves references to entities in schemas as follows:

Creating or altering an access module

When creating or altering an access module, the user can change the names of schemas in table, view, table procedure, procedure, and user-defined function references in SQL data manipulation statements. The user does this by specifying one or more schema mapping rules, each of which supplies a replacement for a schema name. This facility allows a single program (and its associated RCM) to reference one set of tables when it is included in one access module, and another set of tables when it is included in another access module with different schema mapping rules.

When compiling an SQL statement during the creation or alteration of an access module, CA IDMS resolves schema names as follows:

  1. For qualified references to schema entities in non-data manipulation statements, it uses the schema name specified.
  2. For each qualified table, view, table procedure, procedure, or user-defined function reference in a data manipulation statement, CA IDMS uses the replacement schema name as specified in the schema mapping rules. If no replacement has been specified, it uses the schema name specified in the table, view, procedure, or user-defined function reference.
  3. For unqualified references to schema entities in data description statements, it uses the schema name of the access module being created or altered.
  4. For each unqualified table, view, table procedure, procedure, or user-defined function reference in a data manipulation, CA IDMS uses the replacement schema name for the NULL entry in the schema mapping rules. If no such entry is found, it uses the schema name of the access module being created or altered.
  5. For all unqualified references to schema entities, CA IDMS uses the current schema associated with your SQL session.

After resolving the schema names according to the above rules, if CA IDMS cannot find the definition of a table, view, table procedure, procedure, or user-defined function referenced in a data manipulation statement, the statement remains uncompiled and a warning is issued. CA IDMS attempts to recompile the statement at runtime because the table-like object may have been created since compile time.

Automatic access module recreation

CA IDMS automatically recreates an access module at runtime if:

When it automatically recreates an access module, CA IDMS resolves references to schemas using the same rules as were used when the access module was created or last altered except in dealing with unqualified table, view, table procedure, procedure or user-defined function references in data manipulation and EXPLAIN statements:

Note: For more information about automatic access module re-creation, see CREATE ACCESS MODULE or the CA IDMS SQL Programming Guide.