3. Statements : OpenROAD SQL Statements : Rollback Statement
 
Share this page                  
Rollback Statement
This statement rolls back the current database transaction.
This statement has the following syntax:
rollback [work ][to savepointname];
The rollback statement undoes part or all of the current transaction. If you omit the to savepointname clause, the statement terminates the transaction and rolls back any changes made by the transaction.
If you use the to savepointname clause, the transaction is not terminated, and only those changes made after the specified savepoint are rolled back. Processing resumes with the statement following the rollback statement. A rollback statement also closes any open cursors.
Note:  Do not use the to savepointname clause if there are open cursors in the transaction or if you are using a database procedure. Also, the optional work keyword is provided for compatibility with some versions of SQL.
You can use the rollback statement in a database procedure only if the procedure is directly executed and is not invoked by a rule.
If you are running in the autocommit on transaction management state, it is not possible to use the rollback statement, because the DBMS automatically commits each database statement when the statement completes. For more information about transaction management, see the Programming Guide.
The system class, DBSessionObject (see DBSessionObject Class), when used with the RollbackWork method, is equivalent to this statement.