Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateTransaction control statements → ROLLBACK
Firebird Home Firebird Home Prev: RELEASE SAVEPOINTFirebird Documentation IndexUp: Transaction control statementsNext: SAVEPOINT

ROLLBACK

Table of Contents

ROLLBACK RETAIN
ROLLBACK TO SAVEPOINT

Available in: DSQL, ESQL

Syntax: 

ROLLBACK [WORK]
   [TRANSACTION tr_name]
   [RETAIN [SNAPSHOT] | TO [SAVEPOINT] sp_name | RELEASE]
  • The TRANSACTION clause is only available in ESQL.

  • The RELEASE clause is only available in ESQL, and is discouraged.

  • RETAIN and TO are only available in DSQL.

ROLLBACK RETAIN

Available in: DSQL

Added in: 2.0

Description: Undoes all the database changes carried out in the transaction without closing it. User variables set with RDB$SET_CONTEXT() remain unchanged.

Syntax: 

ROLLBACK [WORK] RETAIN [SNAPSHOT]

Note

The functionality provided by ROLLBACK RETAIN has been present since InterBase 6, but the only way to access it was through the API call isc_rollback_retaining().

ROLLBACK TO SAVEPOINT

Available in: DSQL

Added in: 1.5

Description: Undoes everything that happened in a transaction since the creation of the savepoint.

Syntax: 

ROLLBACK [WORK] TO [SAVEPOINT] name

ROLLBACK TO SAVEPOINT performs the following operations:

  • All the database mutations performed within the transaction since the savepoint was created are undone. User variables set with RDB$SET_CONTEXT() remain unchanged.

  • All savepoints created after the one named are destroyed. All earlier savepoints are preserved, as is the savepoint itself. This means that you can rollback to the same savepoint several times.

  • All implicit and explicit record locks acquired since the savepoint are released. Other transactions that have requested access to rows locked after the savepoint must continue to wait until the transaction is committed or rolled back. Other transactions that have not already requested the rows can request and access the unlocked rows immediately.

For a full discussion of savepoints, see SAVEPOINT.

Prev: RELEASE SAVEPOINTFirebird Documentation IndexUp: Transaction control statementsNext: SAVEPOINT
Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateTransaction control statements → ROLLBACK