You can use different share and access modes in the START_
TRANSACTION statement when you intend to access more than
one database in your application. To use this feature, you
must specify a database handle for each database you invoke.
For example, your application can access any relation in one
database using the read-only transaction to check certain data
values while it updates relations in another database using the
read/write transaction.
Note that any START_TRANSACTION statements already contained in
your application programs will continue to execute normally.
Because the read-only transaction uses a snapshot version of the
database, you might encounter inconsistencies in the data your
application retrieves. Therefore, if your program accesses one
database using read-only, another transaction using read/write
might update a relation in the database file itself. The data
your program reads from the snapshot file represents a before-
image of the record the other program is updating. If you require
absolute data consistency for certain update applications, you
should specify the read/write transaction mode for both databases
and permit others to read one of the databases by including the
SHARED READ reserving option. In this way, you maintain data
consistency during updates while permitting concurrent data
retrieval from the database your program reads.
Before you can use the multiple database feature of the START_
TRANSACTION statement, you must issue an INVOKE statement
for each database you intend to access. The INVOKE statement
must include a database handle. For example, the following
INVOKE statements identify two databases required by an update
application.
&RDB& INVOKE DATABASE DB1 = FILENAME 'PERSONAL$DISK:PERSONNEL'
&RDB& INVOKE DATABASE DB2 = FILENAME 'PERSONAL$DISK:BENEFITS'
Because the program only needs to read the EMPLOYEES relation of
the PERSONNEL database (DB1), but needs to change values in two
relations, TUITION and STATUS of the BENEFITS database (DB2),
the update program might contain the following START_TRANSACTION
statement:
&RDB& START_TRANSACTION
&RDB& ON DB1 USING
&RDB& (READ_ONLY
&RDB& RESERVING EMPLOYEES FOR SHARED READ) AND
&RDB& ON DB2 USING
&RDB& (READ_WRITE
&RDB& RESERVING TUITION FOR SHARED WRITE
&RDB& STATUS FOR SHARED WRITE)
If you refer to more than one Oracle Rdb database for actual update
operations within one transaction, use a distributed transaction.
For complete information on distributed transactions, see the
Oracle Rdb Guide to Distributed Transactions.