Примеры.

Версия 1.1 от Alexandr Fokin на 2023/01/08 19:06

Необходимый уровень изоляции 
Read Committed Isolation LevelBEGIN;

 UPDATE accounts SET balance = balance + @payment WHERE acctnum = @account1
 UPDATE accounts SET balance = balance - @payment WHERE acctnum = @account;

COMMIT;
Read Committed Isolation LevelBEGIN;

  if (SELECT balance FROM accounts where acctnum = 7534) < @payment
   RAISE EXCEPTION ''
  END IF

 UPDATE accounts SET balance = balance + @payment WHERE acctnum = 12345;
 UPDATE accounts SET balance = balance - @payment WHERE acctnum = 7534;

COMMIT;