Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the initial state of the following database relations SQL> SELECT * FROM accounts ORDER BY account_id; ACCOUNT_ID 1 2 3 4 5 BAL 1000

Consider the initial state of the following database relations SQL> SELECT * FROM accounts ORDER BY account_id; ACCOUNT_ID 1 2 3 4 5 BAL 1000 2000 1500 6500 500 SQL> SELECT FROM action ORDER BY time_tag; ACCOUNT_ID OPER_TYPE NEW_VALUE 599 TIME TAG 3 u 18-NOV-20 18-NOV-20 6 i 20099 5 d 19-NOV-20 1599 399 STATUS 19-NOV-20 9 d 20-NOV-20 20-NOV-20 10 x 20-NOV-20 1 i Read the following PL/SQL block DECLARE CURSOR c1 IS SELECT account_id, oper_type, new_value FROM action ORDER BY time_tag FOR UPDATE OF status; BEGIN FOR acct IN c1 LOOP acct.oper_type = upper (acct.oper_type); IF acct.oper_type = 'U' THEN UPDATE accounts SET bal acct.new_value WHERE account_id = acct.account_id; IF SQLXNOTFOUND THEN INSERT INTO accounts VALUES (acct.account_id, acct.new_value); UPDATE action SET status = Update: ID not found. Value inserted.' WHERE CURRENT OF C1; ELSE UPDATE action SET status = 'Update: Success." WHERE CURRENT OF c1; END IF; ELSIF acct.oper_typ

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions