Product Documentation

FairCom DB V12 Updates

Previous Topic

Next Topic

Run a SQL Query across Multiple Databases

FairCom DB SQL allows opening multiple local database from the same server. Databases are opened automatically when referenced in a SQL statement, and the same credentials are used for all databases. To access a table in a database other than the default, table name is qualified with a database name and a user name: <dbname>.<owner>.<tablename>. Tables in database other than the default database must be fully qualified, that is both the database name and the owner name must be specified.

Given two databases, the default "ctreeSQL" and "tutor_db". ctreeSQL contains a table "customer" and owned by the "admin" user. "tutor_db" contains a table named "customer" owned by user "tutor".

ISQL> select * from admin.customer, tutor_db.tutor.customer;

Trigger Execution

The execution of triggers takes place in the context of the table on which the trigger resides. Therefore, an insert into a table in the default database will execute a trigger on that table in the context of the default database. An insert into a table in a non-default database, will execute a trigger on that table in the context of the non-default database.

In the FairCom SQL Reference Guide, see Cross Database Query.

TOCIndex