Professional Documents
Culture Documents
Prepared by:
Ravindra Kumar Chahar
Galgotias University
Transaction Processing
Transaction processing availability allows users
to work on the database concurrently. At the
same time it also ensures that each user sees
a consistent version of data and that all the
changes are applied in the right order. Oracle
uses locks to control concurrent access to data
and locks only the minimal amount of data
necessary for the least possible time.
Using commit
Role of commit:
(i) It marks the end of current transaction
(ii) It helps us to save changes made during that
transaction permanent and is visible to all users.
(iii) Example:
update item set qty = qty – 1
where itemid = ‘STN001’;
commit;
Using Rollback
Role of rollback:
(i) It ends the current transaction
(ii) It helps in undoing any changes made during that
transaction
(iii) Thus making mistakes, such as deleting a wrong row can
be restored with the help of this statement.
(iv) Example:
INSERT INTO item (itemid, itemname) values (‘STN001’, ‘Tool’);
rollback;
The changes made by Insert statement has been undone.
Using Savepoint
Example:
conn.close()
Output:
('Himani', 98)
('Ramesh', 95)