Transaction control languages in sql
The SQL Data Control Language (DCL) provides security for your database. The DCL consists of the GRANT, REVOKE, COMMIT, and ROLLBACK statements. GRANT and REVOKE statements enable you to determine whether a user can view, modify, add, or delete database information.
COMMIT
To end your current transaction and make permanent all changes performed in the transaction. This command also erases all savepoints in the transaction and releases the transaction's locks. You can also use this command to manually commit an in-doubt distributed transaction.
COMMIT [WORK]
[ COMMENT 'text'
| FORCE 'text' [, integer] ]
Where:
• WORK : is supported only for compliance with standard SQL. The statements COMMIT and COMMIT WORK are equivalent.
• COMMENT : specifies a comment to be associated with the current transaction. The 'text' is a quoted literal of up to 50 characters that Oracle stores in the data dictionary view DBA_2PC_PENDING along with the transaction ID if the transaction becomes in-doubt.
• FORCE : manually commits an in-doubt distributed transaction. The transaction is identified by the 'text' containing its local or global transaction ID. To find the IDs of such transactions, query the data dictionary view DBA_2PC_PENDING. You can also use the integer to specifically assign the transaction a system change number (SCN). If you omit the integer, the transaction is committed using the current SCN.
COMMIT statements using the FORCE clause are not supported in PL/SQL.
To commit your current transaction, enter
SQL> COMMIT WORK;
Commit complete.
ROLLBACK
To undo work done in the current transaction. You can also use this command to manually undo the work done by an in-doubt distributed transaction.
ROLLBACK [WORK]
[ TO [SAVEPOINT] savepoint
| FORCE 'text' ]
Where:
• WORK : is optional and is provided for ANSI compatibility.
• TO : rolls back the current transaction to the specified savepoint. If you omit this clause, the ROLLBACK statement rolls back the entire transaction.
• FORCE : manually rolls back an in-doubt distributed transaction. The transaction is identified by the 'text' containing its local or global transaction ID. To find the IDs of such transactions, query the data dictionary view DBA_2PC_PENDING. ROLLBACK statements with the FORCE clause are not supported in PL/SQL.
To rollback your current transaction, enter
SQL> ROLLBACK;
Rollback complete.