Save(String)

This method creates a savepoint in the database.

Declaration

// C#
public void Save(string savePointName);

Parameters

savePointName - The name of the savepoint being created in the current transaction.

Exception

InvalidOperationException – The transaction has already been completed successfully, has been rolled back, the connection is closed, or if the connection is enlisted in System.Transactions (local or distributed).

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

Remarks

After creating a savepoint, the transaction does not enter a completed state. It can be rolled back to the specific savepoint instead of rolling back the entire transaction

This method allows the user to create a savepoint within a transaction. It has the same behavior as the OracleTransaction Save(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.

If a previously used savepoint name is specified in the same transaction, the previous one is overwritten with the current savepoint.

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