rollback

Description

Rolls a transaction back to a savepoint inside the transaction or to the beginning of the transaction.

Syntax

exec sql [at connection_name] 
 rollback [transaction | tran | work] 
 [transaction_name | savepoint_name]; 

Parameters

transaction | trans | work

The keywords transaction, trans, and work are interchangeable in the rollback statement, but only work is ANSI-compliant.

transaction_name

The name of the transaction being rolled back.

savepoint_name

The name assigned to the savepoint in a save transaction statement. If you omit savepoint_name, Adaptive Server rolls back the entire transaction.

Examples

Example 1

abort_tran:
 exec sql whenever sqlerror continue:
 exec sql at connect2 rollback transaction;
exec sql at connect1 rollback transaction;
 goto try_update;

Usage

See also

begin transaction, commit