Contents



BEGIN;
UPDATE accounts SET balance = balance - 100.00
WHERE name = Alice;
-- etc etc
COMMIT;

BEGIN ~ COMMIT/ROLLBACK 磯 .
SAVEPOINT朱 れ螳 ..

BEGIN;
UPDATE accounts SET balance = balance - 100.00
WHERE name = Alice;
SAVEPOINT my_savepoint;
UPDATE accounts SET balance = balance + 100.00
WHERE name = Bob;
-- oops ... forget that and use Wallys account
ROLLBACK TO my_savepoint;
UPDATE accounts SET balance = balance + 100.00
WHERE name = Wally;
COMMIT;

碁 豌襴螻殊 る覃 れ螻 螳.

1. 碁

2. UPDATE

UPDATE accounts SET balance = balance - 100.00
WHERE name = Alice;

3. SAVEPOINT my_savepoint : 碁 讌蠍蟾讌
4. UPDATE

UPDATE accounts SET balance = balance + 100.00
WHERE name = Bob;

5. れ 覦

6. ROLLBACK TO my_savepoint : ル SAVEPOINT襦 覲糾

7. UPDATE

UPDATE accounts SET balance = balance + 100.00
WHERE name = Wally;

8. 碁 襭