Oracle rollback | rollback - oracle tutorial - sql tutorial
What is Oracle Rollback ?
- Rollback is the inverse of Commit Statement.
- This statement is used to undo the work performed by the current transaction or a transaction that is in doubt.
- Rollback restore the state of the database to the last commit point.
Syntax:
Example:
- Delete From the “wikitechy table”.
- ROLLBACK is the keyword.
- SELECT from the wikitechy table.
- The Output has been processed according to rollup statement.
Difference between ROLLBACK
- As both ROLLBACK and COMMIT Commands are TCC (Transaction Control Commands), but are not similar to eachother. Here is the difference:
ROLLBACK | COMMIT |
---|---|
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. |
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 ROLLBACK; |
Syntax COMMIT; |