In programs, the READY statement explicitly declares your intention to access one or more databases and causes an attach to the database. READY is not available in RDO. You do not have to use READY to access a database. A database is readied automatically the first time you refer to it. However, you do need an INVOKE DATABASE statement. If you issue a READY statement without specifying a database handle, Oracle Rdb opens all databases declared in that module.
1 – More
You need the Oracle Rdb READ privilege for the database to use the READY statement. You can use the READY statement to test the availability of a database. For example, you may want to check availability before your program prompts a user for input.
2 – Format
(B)0[m[4mREADY[m qqqwqqqq>qqqqqqqqqqqqqqwqqqwqqqq>qqqqqqqqqqqqqwqqqqq> mqwqq> db-handle qwqj mqqqq> on-error qqqj mqqqqqq , <qqqqqj
2.1 – db-handle
Database handle. A host language variable used to refer to a specific database your program invokes.
2.2 – on-error
The ON ERROR clause. Specifies host language statement(s) to be performed if an error occurs during the READY operation.
3 – Examples
Example 1 The following program fragments demonstrate the use of the READY statement to open a database. The program fragments: o Use the INVOKE DATABASE statement to declare the PERSONNEL database o Declare a database handle PERS for PERSONNEL o Open the PERSONNEL database with the READY statement o Close the database with the FINISH statement C Program #include <stdio.h> DATABASE PERS = FILENAME "WORK$DISK:PERSONNEL"; . . main () { READY PERS; . . . FINISH PERS; Pascal Program program empupdate; DATABASE PERS = FILENAME 'WORK$DISK:PERSONNEL'; . . . begin READY PERS; . . . FINISH PERS; Example 2 The following program fragments demonstrate how to open two databases within the same program. The program fragments: o Use the DATABASE statement to declare two databases, PERSONNEL and PAYROLL o Declare database handles for both databases o Open both databases o Close each database C Program #include <stdio.h> DATABASE PERS = FILENAME "WORK$DISK:PERSONNEL"; DATABASE PAY = FILENAME "WORK$DISK:PAYROLL"; main () { . . . READY PERS; . . . FINISH PERS; . . . READY PAY; . . . FINISH PAY; . . . READY PERS, PAY; . . . FINISH PERS, PAY; Pascal Program program new_employee; DATABASE PERS = FILENAME 'WORK$DISK:PERSONNEL'; DATABASE PAY = FILENAME 'WORK$DISK:PAYROLL'; . . . READY PERS; . . . FINISH PERS; . . . READY PAY; . . . FINISH PAY; . . . READY PERS, PAY; . . . FINISH PERS, PAY;