Commit Rollback Oracle

We create a example database:

SQL> create table employee(emp_no NUMBER(4),job_grade VARCHAR2(20));

Tabla creada.

SQL>

SQL> insert into employee(emp_no,job_grade) VALUES ('1','BOFH');

1 fila creada.

SQL> insert INTO employee (EMP_NO,JOB_GRADE,EMP_NAME,EMP_SNAME) VALUES('5','BOFH','Peter','Perkins');

1 fila creada.

SQL>

so we have the following structure:

SQL> select * from employee;

    EMP_NO JOB_GRADE            EMP_NAME             EMP_SNAME
---------- -------------------- -------------------- --------------------
         5 BOFH                 Peter                Perkins
         1 BOFH                 David                Aniones
         2 BOSS                 Ramon                Monina
         3 MANAGER              Onin                 Onionhood
         4 GOD                  Xesar                Palerta

We set a resore point in here, and alter some data:
SQL> savepoint foo;

Punto de grabaci┬żn creado.
SQL> UPDATE employee SET JOB_GRADE='BOSS' WHERE EMP_NAME='Peter' AND EMP_SNAME='
Perkins';

1 fila actualizada.
SQL>
Now we can check the results:

SQL> select * from employee ORDER BY EMP_NO;

    EMP_NO JOB_GRADE            EMP_NAME             EMP_SNAME
---------- -------------------- -------------------- --------------------
         1 BOFH                 David                Aniones
         2 BOSS                 Ramon                Monina
         3 MANAGER              Onin                 Onionhood
         4 GOD                  Xesar                Palerta
         5 BOSS                 Peter                Perkins
SQL>

Now we can rollback to the previous "foo" savepoint and check again:
SQL> rollback to savepoint foo;

Rollback terminado.

SQL> select * from employee ORDER BY EMP_NO;

    EMP_NO JOB_GRADE            EMP_NAME             EMP_SNAME
---------- -------------------- -------------------- --------------------
         1 BOFH                 David                Aniones
         2 BOSS                 Ramon                Monina
         3 MANAGER              Onin                 Onionhood
         4 GOD                  Xesar                Palerta
         5 BOFH                 Peter                Perkins

SQL>

Now we just downgraded Peter to BOFH :)