Working with a single savepoint
Banks that carry large value in Money Market Deposit Accounts (MMDA) are often resilient to downturns in the economy. In order to classify banks, we'll use a flag field such as FIELD48
to store information useful for further processing. Let's flag banks with over 5000000.
Diese Übung ist Teil des Kurses
Transactions and Error Handling in PostgreSQL
Anleitung zur Übung
- Create a transaction.
- Update
FIELD48
toMMDA
ifRCON6810
(MMDA value) is greater than5000000
. - Set a savepoint named
mmda_flag_set
. - Rollback the whole transaction.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
BEGIN;
-- Set the flag to indicate that they hold MMDAs where more than $5 million
UPDATE ffiec_reci
SET FIELD48 = '___'
WHERE ___ > 5000000;
-- Set a savepoint
___ ___;
-- Rollback the whole transaction
___;
COMMIT;