Site icon IT Tutorial

Oracle SQL Tutorials – Chapter 6 (Part 2 of 2)

DATABASE TRANSACTIONS

 

COMMIT & ROLLBACK

 

 

SAVEPOINT

 

BEFORE COMMIT OR ROLLBACK

 

AFTER COMMIT

 

 

COMMIT EXAMPLE

First State :

DELETE FROM hr.jobs WHERE job_id='AD_PRES';

Current user see like that;

 

But other users see like that; There is still ‘AD_PRES’ row. Because we didn’t commit.

Now I will commit, so changes will be permanent

COMMIT ;

 

 

AFTER ROLLBACK

 

ROLLBACK EXAMPLE

First State of the hr.job_history table :

DELETE FROM hr.job_history;

ROLLBACK ;

 

 

FOR UPDATE

 

FOR UPDATE EXAMPLE

SELECT * FROM hr.employees FOR UPDATE;

Exit mobile version