ROLLBACK Statement

Rolls back transaction changes to the beginning of the transaction.

Category: Data Control
Restriction: The ROLLBACK statement has an effect only when autocommit functionality is off.
Supports: EXECUTE Statement
Data source: Greenplum, HAWQ, MDS, MySQL, ODBC, Oracle, SAP HANA, Sybase IQ, Teradata

Syntax

ROLLBACK [TRANSACTION];

Details

When your program has completed all of the statements in the transaction, you must explicitly terminate the transaction using COMMIT or ROLLBACK. You use a ROLLBACK statement to roll back, or undo, the changes that have been made since the start of the transaction.
You cannot roll back the changes to the database after a COMMIT statement is executed.
The ROLLBACK statement has an effect only when autocommit functionality is off. For most data sources, autocommit functionality is on by default. See the server administration documentation for information about how to turn off autocommit functionality. For example, see SAS Federation Server: Administrator’s Guide for the appropriate connection option to the FedSQL driver. For the FEDSQL procedure, see Base SAS Procedures Guide.
Note: ROLLBACK has no effect on the SASHDAT data source.

Comparisons

The COMMIT statement takes all the changes that have been performed since the start of the transaction and makes them a permanent part of the database. The ROLLBACK statement causes all the changes that were made by the transaction to be rolled back to the start of the transaction.

See Also

Last updated: February 23, 2017