You can qualify the names of objects in an SQL statement in order to uniquely identify different objects that have the same name. The following qualifications are possible:
qualification with the database name for:
schema, space, storage group, table, index, integrity constraint and routinequalification with the schema name for:
table, index, integrity constraint and routinequalification with the table name or the correlation name for:
column (see "Table specifications")
The syntax overview below illustrates these possibilities:
qualified_name ::=
{
index
|
integrity_constraint_name
|
routine
|
schema
|
space
|
stogroup
|
table }
index ::= [[
catalog .]
unqual_schema_name .]
unqual_index_name
integrity_constraint_name ::= [[
catalog .]
unqual_schema_name .]
unqual_constraint_name
routine ::= [[
catalog .]
unqual_schema_name .]
unqual_routine_name
schema ::= [
catalog .]
unqual_schema_name
space ::= [
catalog .]
unqual_space_name
stogroup ::= [
catalog .]
unqual_stogroup_name
table ::=
{
[[
catalog .]
unqual_schema_name .]
unqual_base_table_name |
[[
catalog .]
unqual_schema_name .]
unqual_view_name |
correlation_name }
Implicit qualification
The following implicit qualification is valid:
If no schema qualification is specified, the name refers to the default schema.
If no catalog qualification is specified, the name refers to the default database.
The default schema and database are set with the precompiler option SOURCE-PROPERTIES (see the “ ESQL-COBOL for SESAM/SQL-Server” manual). The default database and schema names can be redefined with SET CATALOG and SET SCHEMA respectively. The redefined default values are valid for all statements prepared with PREPARE or executed with EXECUTE IMMEDIATE from the time redefinition is performed up until the defaults are redefined again or until the end of the SQL session.
Example
Qualifying a table name indicates the schema and database to which the table belongs:
ordercust.orderproc.customers:
CUSTOMERS
table in the ORDERPROC
schema of the ORDERCUST
database
orderproc.customers:
CUSTOMERS
table in the ORDERPROC
schema of the default database.
customers:
CUSTOMERS table in the default schema
Overview
Name type | Examples | Meaning |
Regular name |
| “Customers” and “customers” are |
| Numerics and the underscore | |
Special name |
| Special characters are permitted |
| Quotes must be entered twice | |
Unqualified name |
| Schema ORDERPROC |
Qualified name |
| Table VIEW1 in the schema |
| Single column SELECT(5) in the | |
| Occurrence of the multiple column | |
| Column name ORDER_NUM |
Table 10: Names in SESAM/SQL