1 ROLLBACK Terminates a transaction and undoes all changes that have been made to the database since the program's most recent START_ TRANSACTION statement. The ROLLBACK statement also closes all open streams and releases all locks. The ROLLBACK statement affects both data manipulation and data definition statements. Example: RDO> START_TRANSACTION READ_WRITE RDO> DEFINE FIELD LOCATION_CODE DATATYPE TEXT SIZE 5. RDO> ! Oops, wrong size! RDO> ROLLBACK RDO> START_TRANSACTION READ_WRITE RDO> DEFINE FIELD LOCATION_CODE DATATYPE TEXT SIZE 7. RDO> COMMIT 2 Format (B)0ROLLBACK qqwqqqqqqqqqqqqqqqqqqqqqqq>qqqqqqqqqqwqwqqqqqqqqqqqqqqqqwqqq> mq> (TRANSACTION_HANDLE qq> var) qqj mqq> on-error qqqj 3 TRANSACTION_HANDLE A keyword followed by a host language variable. A transaction handle identifies each instance of a transaction. If you do not declare the transaction handle explicitly, Oracle Rdb attaches an internal identifier to the transaction. In Callable RDO, use !VAL as a marker for host language variables. You can put parentheses around the host language variable name. Normally, you do not need to use this argument. The ability to declare a transaction handle is provided for compatibility with other database products and future releases of Oracle Rdb. 3 on-error The ON ERROR clause, which specifies a host language statement to be performed if an Oracle Rdb error occurs. For more details, request HELP on ON_ERROR. 2 More If you have invoked a database, you have the necessary privileges to use the ROLLBACK statement. 2 Example Roll back changes made during a transaction with a COBOL program: GET-ID-NUMBER. DISPLAY "Enter employee ID number: " WITH NO ADVANCING. ACCEPT EMPLOYEE-ID. CHANGE-SALARY. DISPLAY "Enter new salary amount: " WITH NO ADVANCING. ACCEPT SALARY-AMOUNT. &RDB& START_TRANSACTION READ_WRITE &RDB& FOR S IN SALARY_HISTORY WITH &RDB& E.EMPLOYEE-ID = EMPLOYEE-ID &RDB& MODIFY USING &RDB& S.SALARY-AMOUNT = SALARY-AMOUNT &RDB& END-MODIFY &RDB& END-FOR DISPLAY EMPLOYEE-ID, SALARY-AMOUNT. DISPLAY "Is this figure correct? [Y or N] " WITH NO ADVANCING. ACCEPT ANSWER. IF ANSWER = "Y" THEN &RDB& COMMIT ELSE &RDB& ROLLBACK DISPLAY "Please enter the new salary amount again." GO TO CHANGE-SALARY.