Get startedGet started for free

Working with repeatable read

With the video in mind, let's do some hands on work with a repeatable read transaction. We want to set a "stability" factor for a bank's in-house assets if they allow consumer deposits. We'll do this by setting a custom field, FIELD48, equal to a retainer value if the bank allows consumer deposit accounts as indicated in RCONP752.

Interference from an external transaction would alter the application of our factor. Repeatable read protects your transaction from outside sources changing data that was available to us when we ran our first query in the transaction.

This exercise is part of the course

Transactions and Error Handling in PostgreSQL

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Create a new transaction with a repeatable read isolation level
___ ___ ___ ___ ___ ___;

-- Update records for banks that allow consumer deposit accounts
UPDATE ffiec_reci 
SET FIELD48 = 100 
WHERE RCONP752 = 'true';

-- Update records for banks that do not allow consumer deposit accounts
UPDATE ffiec_reci 
SET FIELD48 = 50 
WHERE RCONP752 = 'false';

-- Commit the transaction
___;
Edit and Run Code