Rollback(String)

This method rolls back the local transaction to a specified savepoint.

Declaration

// C#
public void Rollback(string savepointName);

Exception

InvalidOperationException – If the connection is closed or if the connection is enlisted in System.Transactions (both local and distributed).

System.ObjectDisposedException – This property cannot be accessed after the OracleConnection object is already disposed.

Oracle.ManagedDataAccess.Client.OracleException – When a savepoint passed in has not been previously established by a Save(String savepoint), or is an invalid savepoint.

Remarks

After a rollback to a savepoint, the current transaction remains active and can be used for further operations.

This method allows the application to rollback a local transaction to the specific savepoint. It has the same behavior as the OracleTransaction Rollback(string savepoint) method. However, there are instances when this method is necessary to invoke without the OracleTransaction object available, such as an implicit transaction using “SELECT … FOR UPDATE” or an implicit transaction executing an INSERT/UPDATE/DELETE statement with auto-commit disabled.

This method should not encounter any exceptions when the connection is within an explicit local transaction, implicit local transaction, or not associated with a transaction. This method cannot be executed on a connection enlisted in System.Transactions.

Since savepoints are created in the database in a case-insensitive manner, the savepoints name cases of the Rollback and Save method do not have to match.