ALLBASE/SQL Reference Manual (36216-90216)

496 Chapter11
SQL Statements E - R
ROLLBACK WORK
since the designated savepoint are undone. If any cursors opened with the KEEP
CURSOR option were active in this transaction, the statement fails and the rollback is
not done. In an application program or procedure, all open cursors are automatically
closed.
Any savepoints defined more recently than the designated savepoint are lost and
become invalid. The designated savepoint is still valid and can be specified in a future
ROLLBACK WORK statement. The transaction is not ended. Any locks obtained since the
savepoint was set are released.
If the current transaction is the one in which you opened a cursor with the KEEP
CURSOR option, then the ROLLBACK WORK statement closes the cursor and undoes any
changes made through it.
Under some circumstances ALLBASE/SQL automatically rolls back a transaction. For
example, when service is restored after a system failure, all uncommitted transactions
are automatically backed out.
If RELEASE is used, all cursors are closed and the current connection is terminated.
The RELEASE option is not allowed within a procedure.
Authorization
You do not need authorization to use the ROLLBACK WORK statement.
Example
Transaction begins.
BEGIN WORK
statement-1
SAVEPOINT :MyVariable
statement-2
statement-3
Work of statements 2 and 3 is undone.
ROLLBACK WORK
TO :MyVariable
Work of statement 1 is committed; transaction ends.
COMMIT WORK