4. Maintaining a Distributed Database : Register as Link Statement—Define Database Objects to Ingres Star : Register Table as Link Statement—Define Table to Ingres Star : Examples: Register Table as Link
 
Share this page                  
Examples: Register Table as Link
Consider the following database configurations, used in examples in this and following sections:
The distributed database corporateddb resides on the london node with its coordinator database corporate. The table, prospects, has been created locally in corporate.
A remote database pacific is on a node tokyo and contains a table, customers.
A second remote database west_usa resides on the node reno and contains a table, sales and a view, follow_ups. The table, sales belongs to user john and has columns customer, invoice_number and total.
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;