LoslegenKostenlos loslegen

Multiple savepoints

A risky area for banks during a distressed market is the number of maturing time deposits in the near future. It's highly likely that these timed deposits will be withdrawn to make other financial moves by the depositor. RCONHK07 + RCONHK12 stores those maturing in the next three months and RCONHK08 + RCONHK13 stores those expiring between 3 and 12 months.

If the total amounts in these columns are higher than $10 million it can be a drag on available funds to cover withdrawals and would receive a negative rating. Additionally, if there is less than $2 million, it has been shown to be a positive factor.

Diese Übung ist Teil des Kurses

Transactions and Error Handling in PostgreSQL

Kurs anzeigen

Anleitung zur Übung

  • Within a transaction set FIELD48 to mature+ if total maturing deposits is less than $2 million and set a savepoint matureplus_flag_set.
  • Set FIELD48 to mature- if total maturing deposits is between $2 million and $10 million then set a savepoint matureminus_flag_set.
  • Set FIELD48 to mature-- if total maturing deposits is greater than $10 million.
  • Count all the banks with a positive deposit maturity schedule.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

BEGIN;

-- Update FIELD48 to indicate a positive maturity rathing when less than $2 million of maturing deposits.
UPDATE ffiec_reci 
SET ___ = '___' 
WHERE RCONHK07 + RCONHK12 + RCONHK08 + RCONHK13 < 2000000;

-- Set a savepoint
SAVEPOINT ___;

-- Update FIELD48 to indicate a negative maturity rathing when between $2 and $10 million 
UPDATE ffiec_reci 
SET ___ = '___' 
WHERE RCONHK07 + RCONHK12 + RCONHK08 + RCONHK13 BETWEEN 2000000 AND 10000000;

-- Set a savepoint
SAVEPOINT ___;

-- Update FIELD48 to indicate a double negative maturity rathing when more than $10 million
UPDATE ffiec_reci 
SET ___ = '___' 
WHERE RCONHK07 + RCONHK12 + RCONHK08 + RCONHK13 > ___;

COMMIT;

-- Count the records where FIELD48 is a positive indicator
SELECT count(FIELD48) 
FROM ffiec_reci 
WHERE FIELD48 = 'mature+';
Code bearbeiten und ausführen