<<Previous Next>>
Oracle - Explain how save
point works - Feb 23, 2010 at 11:00 PM
by Rajmeet Ghai
Explain how save point
works.
Save points in Oracle can be used for partial rollbacks. For
instance we write few SQL statements and don’t want all of them to
be committed. We can insert a save point in between and roll back
changes until that save point.
Example: UPDATE emp_name SET salary = salary + 1000 WHERE
employee_id = 100;
DELETE FROM emp_name WHERE employee_id =
130; SAVEPOINT
do_insert; INSERT INTO
emp_name VALUES (emp_id, emp_lastname, emp_salary);
On using rollback: rollback to do_insert;
Two-Phase Commit has two phases, a prepare phase and a commit
phase..........
Oracle server implicitly starts a new transaction with the
following two conditions: The first executable statement of a new
user session automatically starts a new transaction.............
Rollback and commit statement controls database transactions.
Both statements ensure the data consistency. They allow users to
preview the data before making permanent............
The read consistency is set at the statement level in a READ
WRITE transaction...............
|