The register as link statement defines a distributed database component name to Ingres Star as an alias of a local or remote table or view. The statement is stored in the iiregistrations catalog.
Use the register as link statement to define to Ingres Star:
Note: To register non-SQL data, you first must identify the data to the non-SQL Enterprise Access with the register as import statement. For information on how to use this statement, see the guide for your specific Enterprise Access.
The register as link statement has the following format:
register object_type object_name
[(col_name {, col_name})]
as link
[from [local_owner_name.]local_object_name]
[with
[node = node_name,
database = database_name]
[, dbms = server_class]]
Can be table, view or database procedure. For tables or views, the object_type is optional. However, to register a database procedure, the keyword procedure must be specified.
Is the Ingres Star name of the local DBMS table, view, or database procedure you are registering. It may be delimited with double quotes.
Is the Ingres Star name of the corresponding column in the local DBMS table or view. (Do not use when registering procedures.) It may be delimited with double quotes.
There can be as many column names as Ingres Star allows in a table or view. This column name is the one used in queries presented to Ingres Star. All column names must follow the Ingres naming conventions.
This column name must be specified in the order corresponding to its location in the underlying local DBMS table or view (the nth Ingres Star column name corresponds to the nth local column name.)
All columns must be named. If column names are not specified, Ingres Star uses the column names obtained from the local DBMS standard catalogs for the table or view specified.
Indicates that the register statement will create an Ingres Star registration linked to a table, view, or database procedure in a local database. This clause must be specified.
Specifies the owner and name of the local table, view, or database procedure you are registering. You must use this clause if you are registering an object in your distributed database with a different name from its name in the local database, or the object name does not follow Ingres naming conventions, is case sensitive, or is owned by another user.
Is the name of the table, view, or database procedure in the local database.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter in order for Ingres Star to preserve the case.
Is the name of the owner of the object in the local database. You can register other user's tables, views, and database procedures, but you must specify the owner name. If you do not specify an owner name, local_owner_name defaults first to an object owned by the current user, second to an object owned by the DBA, and third to an object owned by $ingres.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter for Ingres Star to preserve the case.
Do not forget to include the period at the end of the owner name.
Provides additional information about the local database table, view, or database procedure being registered and its location in relation to Ingres Star.
Is the Net vnode name (the virtual node name) that holds the object you are registering. The default is the node that contains the Star Server processing the command. The node_name may be up to 32 characters long. It may be delimited with double quotes.
If you specify the node = clause, you also must specify the database = clause.
Specifies the name of the local database that contains the object you are registering. It may be delimited with double quotes.
The database name may be up to 256 bytes long provided it is specified in quotes.
If you specify the database = clause, you must specify the node = clause. If the database is omitted, the coordinator database is the default.
Specifies the type of local DBMS that contains the object being registered.
The server_class must be Ingres or one of the SQL Enterprise Access products. If you do not specify a server class the default is the value in default_server_class on the remote installation (Ingres, unless defined otherwise.) Use the Configure Name Server screen of the CBF or Visual CBF utilities to view or change this value.
The register table as link statement defines an already existing local DBMS table to Ingres Star. No new table is created. All secondary indexes associated with the table are registered automatically when you register a table in your distributed database if the table is in a local database.
The register table as link statement has the following format:
register [table] table_name
[(col_name {, col_name})]
as link
[from [local_owner_name.]local_table_name]
[with
[node = node_name,
database = database_name]
[, dbms = server_class]]
Is an optional object type identifier. Whether or not you specify table, Ingres Star queries the local DBMS and determines the object type.
If you specify table, Ingres Star issues an error if the local DBMS type is not a table.
Is the Ingres Star name of the local DBMS table you are registering.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter in order for Ingres Star to preserve the case.
This name must follow Ingres naming conventions. It will appear in the Ingres Star catalogs as a table. In the table_subtype column of the iitables standard system catalog, it will have a subtype of L (registered as Link). For information, see the chapter "Understanding Ingres Star Catalogs."
Is the name of the table in the local DBMS.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter in order for Ingres Star to preserve the case.
The default is to use the distributed database table_name you specify as the name of the local DBMS table that you are registering.
Enter this name if you are registering the table in your distributed database with a name different from its name in the local DBMS or if the table name in the local DBMS does not follow naming conventions and/or is case sensitive or is owned by another user.
Note: This table name must be the actual base table name, not a synonym.
The elements that are common to all three register as link statements are described in Register as Link Statement.
Consider the following database configurations, used in examples in this and following sections:
The following statement issued in a session with the distributed database corporateddb registers the prospects table from the coordinator database in corporateddb:
register prospects as link;
This statement registers prospects in corporateddb under the name west_prospects:
register west_prospects as link
from prospects;
This statement registers the table, sales from the database west_usa on the nod, reno, giving it the name usa_sales and referring to its columns as customer, inv_no and amount:
register table usa_sales
(customer, inv_no, amount) as link
from john.sales
with node = reno, database = west_usa;
If the distributed database corporateddb is case sensitive and you wish to create registrations with case-sensitive names, or if you wish to include special characters in the registration name, you would use a delimited identifier to specify the registration. The following example shows how you would register a table named usa sales into corporateddb:
register table "usa sales"
(customer, "inv no", amount) as link
from john.sales
with node = reno, database = west_usa;
If the west_usa database allows mixed-case identifiers, or if the local table name includes mixed-case or special characters, you would use a delimited identifier in the from clause. For example, john's table may be named Sales.
register table usa_sales
(customer, inv_no, amount) as link
from john."Sales"
with node = reno, database = west_usa;
Note: You can use a delimited identifier on the from clause only if the case-translation semantics of both the distributed database and the local database are compatible. Ingres Star rejects the above statement if corporateddb does not support mixed-case identifiers and west_usa does support them. The reason for this is that the identifier Sales will be case converted by the Star Server, and any mixed-case characters will have been converted before the registration is processed. In this instance, you would use single quotes. The Star Server does not translate singly-quoted strings. For example:
register table usa_sales
(customer, inv_no, amount) as link
from john."Sales"
with node = reno, database = west_usa;
The register view as link statement defines an already existing local DBMS view to Ingres Star. No new view is created.
The register view as link statement has the following format:
register [view] view_name
[(col_name {, col_name})]
as link
[from [local_owner_name.]local_view_name]
[with
[node =node_name,
database =database_name]
[, dbms = server_class]]
An optional object identifier. Whether or not you specify view, Ingres Star queries the local DBMS and determines the object type.
If you specify view, Ingres Star issues an error if the local DBMS type is not a view.
The Ingres Star name of the local DBMS view you are registering.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter in order for Ingres Star to preserve the case.
This name must follow Ingres view naming conventions. It will appear in the Ingres Star catalogs as a view. In the table_subtype column of the iitables standard system catalog, the Ingres Star view name will have a table_subtype of L (registered as Link). (For more information on catalogs, see the chapter "Understanding Ingres Star Catalogs.")
The name of the view in the local DBMS.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter in order for Ingres Star to preserve the case.
The default is to use the distributed database view_name you specify as the name of the local DBMS view that you are registering.
Enter this name if you are registering the view in your distributed database with a name different from its name in the local DBMS or if the view name in the local DBMS does not follow Ingres naming conventions and/or is case sensitive or is owned by another user.
Note: This name must be the actual base name, not a synonym.
The elements that are common to all three register as link statements are described in Register as Link Statement.
This statement registers the view follow_ups from the database west_usa on the node reno, and gives it the name usa_visits:
register view usa_visits as link
from follow_ups
with node = reno, database = west_usa;
The register procedure as link statement defines an already existing local DBMS database procedure to Ingres Star. No new database procedure is created.
The register procedure as link statement has the following format:
register procedure procedure_name
as link
[from [local_owner_name.]local_procedure_name]
[with
[node = node_name,
database = database_name]
[, dbms = server_class]]
Identifies the object type
The Ingres Star name of the local DBMS database procedure you are registering.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter in order for Ingres Star to preserve the case.
The name of the database procedure in the local DBMS.
It may be delimited with double quotes to preserve case and allow special characters. However, if the Ingres Star database does not support mixed-case delimited identifiers and the local DBMS or Enterprise Access product does support mixed-case delimited identifiers, you should use a single-quote delimiter in order for Ingres Star to preserve the case.
The default is to use the distributed database procedure_name you specify as the name of the local DBMS database procedure that you are registering.
Enter this name if you are registering the database procedure in your distributed database with a name different from its name in the local DBMS or if the name in the local DBMS does not follow naming conventions, is case sensitive, or is owned by another user.
The elements that are common to all three register as link statements are described in Register as Link Statement.
This statement registers LDB1 procedure p2 (on node node_A) using the same name in Ingres Star:
register procedure p2 as link
with node=node_A, database=LDB1;
This statement registers LDB1 procedure p3 using the name proc2 in Ingres Star:
register procedure proc2 as link from p3
with node=node_a, database=LDB1;
The text for the register as link statement is stored in the iiregistrations standard catalog.
You can execute the register statement through dynamic SQL by the execute immediate statement.
For example, the following command registers the table customers from the database pacific on the node tokyo:
exec sql execute immediate
'register customers as link
with node = tokyo, database = pacific';
Note: Do not use the prepare statement for executing the register as link statement. Use execute immediate as described here.