Questions: Which TCL statement should you use to establish a rollback position for a transaction in case the transaction fails? ROLLBACK COMMIT SET SAVEPOINT

Which TCL statement should you use to establish a rollback position for a transaction in case the transaction fails?

ROLLBACK
COMMIT
SET
SAVEPOINT
Transcript text: Which TCL statement should you use to establish a rollback position for a transaction in case the transaction fails? ROLLBACK COMMIT SET SAVEPOINT
failed

Solution

failed
failed

The answer is the fourth one: SAVEPOINT.

Explanation for each option:

  1. ROLLBACK: This statement is used to undo transactions that have not yet been saved to the database. It reverts the database to the last committed state. However, it does not establish a rollback position; it is used to roll back to a previously established position.

  2. COMMIT: This statement is used to save all the transactions to the database. Once a transaction is committed, it cannot be rolled back. Therefore, it does not establish a rollback position.

  3. SET: This is not a Transaction Control Language (TCL) statement. It is generally used in SQL to assign a value to a variable.

  4. SAVEPOINT: This statement is used to set a point within a transaction to which you can later roll back. It establishes a rollback position within a transaction, allowing partial rollbacks.

Summary: To establish a rollback position for a transaction in case the transaction fails, you should use the SAVEPOINT statement.

Was this solution helpful?
failed
Unhelpful
failed
Helpful