Table qualifiers can appear in the SQL of 4GL statements, as well as in the declaration of a table alias within the TABLES section of a form specification file. However, table qualifiers cannot be included in other parts of a form specification file, table aliases are needed instead. It is also not possible to prefix a form field or an alias with a table qualifier.
|
Database |
The name of a database which contains the table, view, or synonym |
|
Server |
The name of the server on which the database is running |
|
Owner |
The login name of the owner of the table, view, or synonym. It immediately precedes the table name |
|
String constant |
The schema ID or the owner qualifier written as quoted character strings for ANSI compatibility |
A complete table qualifier has this structure:
database@server:owner
If you use the ANSI-compliant quoted character strings, it can look like this:
"database@server":"owner"
The full name of a table column with a complete table qualifier will look like this:
database@server:owner.table.column
It is obligatory to specify the owner of a table in a table qualifier if there is another table with the same name within the same database. In an ANSI-compliant database you must specify the owner of all the tables which you do not own, even if they have unique names. If you use an ANSI-compliant database as your current database, an error will occur if you try to reference a not ANSI-compliant database as a remote database.
You are free to include the owner of a table in a not ANSI-compliant database which has a unique identifier; however, if the owner qualifier is incorrect then the 4GL will produce an error.
Either database: or database@server: qualifier can be used with the LIKE keyword (within the DEFINE, INITIALIZE, VALIDATE statements) to specify a table or a table column that is not in the current database. The tables and table columns without such qualifier will be searched in the current database, which needs to be specified before the first program block within the same module. To be able to use the LIKE keyword within the above mentioned statements, you need to include the DATABASE statement that will specify the current database.
Current database is specified by the most recently used DATABASE statement, it can be used repeatedly within a function or the main block. The only action that can be done with the information in a database, which is not your current database and which is referenced with the help of a table qualifier, is to use the SELECT statement. It is not possible to modify (delete, update, or insert) rows within a database that is not your current database.
The qualifier @server is optional and is used after the database name in a table qualifier, if the table resides on another host system, e.g.:
cms@my_host:smith_john.order_table
If a database resides in your current directory, or if the location of a database is specified in the DBPATH environment variable, you do not need to specify the server name.