Difference Between Rollback and Commit in Oracle

ROLLBACK vs COMMIT

As both ROLLBACK and COMMIT Commands are TCC (Transaction Control Commands), but are not similar to eachother. Here is the difference:

ROLLBACK Command

To undo the work/changes that are committed or done by COMMIT clause we use the ROLLBACK Command. It is reverse of COMMIT. It rollbacks all the changes of the current transactions. In other words ROLLBACK restore the state of the database to the last commit point.

Syntax

DELETE FROM table_name
ROLLBAC

COMMIT Command


Whatever changes we have made/ done in our transaction cannot be fixed until we commit that transaction and this can be possible by using COMMIT statement. In other words it will make our changes permanent that cannot be rolled back.

Syntax

COMMIT;

Syntax: when both are used at the same time:

BEGIN [WORK]
COMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
ROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]