Professional Documents
Culture Documents
Lab 09
Triggers & Transactions
Triggers
A trigger is an event within the DBMS that can cause some code
to execute automatically
2) Next BEFORE row level triggers fires, once for each row
affected.
3) Then AFTER row level trigger fires once for each affected row.
This events will alternates between BEFORE and AFTER row level
triggers.
• Syntax:
COMMIT;
ROLLBACK
• Syntax:
ROLLBACK;
Select * from products;
DELETE from products where product_id = 100;
• Syntax:
SAVEPOINT SAVEPOINT_NAME;
• ROLLBACK TO SAVEPOINT_NAME;
Select * from product;
rollback to sp3;
rollback to sp2;
rollback to sp1;
Transaction Isolation Levels
Isolation determines how transaction integrity is visible to other
users and systems.
• Concurrency
• This simply means that if you read a row at time T1 and try to
reread that row at time T2, the row may have changed. It may
have disappeared; it may have been updated, and so on.
Phantom read
• This means that if you execute a query at time T1 and
re-execute it at time T2, additional rows may have been
added to the database, which may affect your results.
• Serially executed
COMMAND TO SET
ISOLATION LEVEL: