The ROLLBACK WORK statement is valid only in databases that support transaction logging.
In a database that is not ANSI compliant, you start a transaction with the BEGIN WORK statement. You can end a transaction with the COMMIT WORK statement or cancel the transaction with a ROLLBACK WORK statement. The ROLLBACK WORK statement restores the database to the state that existed before the transaction began.
Use ROLLBACK WORK only at the end of a multistatement operation.
The ROLLBACK WORK statement releases all row and table locks that the cancelled transaction holds. If you issue a ROLLBACK WORK statement when no transaction is pending, an error occurs.
In an ANSI-compliant database, transactions are implicit. You do not need to mark the beginning of a transaction with a BEGIN WORK statement. You only need to mark the end of each transaction with a COMMIT WORK statement or cancel the transaction with a ROLLBACK WORK statement. If you issue a ROLLBACK WORK statement when no transaction is pending, the statement is accepted but has no effect.
In ESQL/C, the ROLLBACK WORK statement closes all open cursors except those that are declared as hold cursors (by including the WITH HOLD keywords). Hold cursors remain open after a transaction is committed or rolled back.
If you use the ROLLBACK WORK statement within an SPL routine that a WHENEVER statement calls, specify WHENEVER SQLERROR CONTINUE and WHENEVER SQLWARNING CONTINUE before the ROLLBACK WORK statement. This step prevents the program from looping if the ROLLBACK WORK statement encounters an error or a warning.
The WORK keyword is optional in a ROLLBACK WORK statement. The following two statements are equivalent:
ROLLBACK; ROLLBACK WORK;
Related statements: BEGIN WORK and COMMIT WORK
For a discussion of transactions and ROLLBACK WORK, see the IBM Informix Guide to SQL: Tutorial.