SQLROLLBACK Verb - Rollback Current Transaction

Syntax

SQLROLLBACK(sqlchan{,ERR=lineref})

Description

The SQLROLLBACK verb instructs the connection to rollback its current transaction. An error is returned if the rollback fails or if AUTO_COMMIT mode was set to ON (default) when the connection was opened using SQLOPEN.

To allow for transactions, the AUTO_COMMIT mode must be set to OFF during the SQLOPEN call. The following example opens a connection to the MyData data source with transaction tracking enabled, inserts a new record, then performs a rollback to undo the INSERT operation:

SQLOPEN(1,MODE="AUTO_COMMIT=OFF")"MyData"
SQLPREP(1)"INSERT INTO mytable VALUES ('10', 'Sample Record')"
SQLEXEC(1)
SQLROLLBACK(1)
SQLCLOSE(1)

Note that the SQLROLLBACK verb has no effect on data sources that do not support transaction tracking.

See Also

Verbs - Alphabetical Listing