Oracle: ROLLBACK Statement

Profile picture for user akshita.goel
Submitted by akshita.goel on

What is Rollback in Oracle?

  1. As you all are now familiar with the commit command or if not you can click here.
  2. Rollback in Oracle is used to reverse all of the changes done in the database before COMMIT is applied to it.
  3. In other words, Rollback is just an undo button used to undo all changes done before saving it.

Let's Consider we have a table, Stu, with values as shown below:

Stu Table

Now, as a user you need to make some operations in the table pasted above. But, you want those changes not to get saved. However, for that, you can use ROLLBACK Command.


The syntax of the ROLLBACK command is written below:



You made some changes in the Stu table by deleting some of its rows. However, after deleting some rows your output looks like below:

Stu Table

Now, if I need to unsave all the changes that I have applied, I will use the ROLLBACK command  and get output as follows:



Kindly find below the output of Stu Table after Rollback below: