Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE I NEED HELP SOLVING THIS PROBLEMs. THANK YOU!! THE QUESTION IS PROVIDED BELOW ALONG WITH THE TABLES ASSOCIATED WITH IT THE TRIGEX TABLE IS

PLEASE I NEED HELP SOLVING THIS PROBLEMs. THANK YOU!! THE QUESTION IS PROVIDED BELOW ALONG WITH THE TABLES ASSOCIATED WITH IT

image text in transcribed

image text in transcribed

THE TRIGEX TABLE IS BELOW--------

SQL> start C:\SQLspring23\sqlstuff\trig\S23-trigex03

SQL> create or replace trigger ledger_bef_upd_ins_row

2 before insert or update of amount on ledger

3 for each row

4 begin

5 if inserting then

6 insert into ledger_audit

7 values (:new.actiondate, :new.quantity,

8 :new.rate, :new.amount, :new.person);

9 else

10 insert into ledger_audit

11 values (:new.actiondate, :new.quantity,

12 :new.rate, :new.amount, :new.person);

13 end if;

14 end;

15 /

IF POSSIBLE , IF YOU CAN USE ORACLE TO DO THE SQL CODING FOR THIS ASSINGNMENT.

The file S23-createledger.sql creates the LEDGER, LEDGER_AUDIT, and LEDGER_TRANS_LOG tables and populates the LEDGER table with five rows of data and (b) the file S23-trigex03.sql (shown on page 12 of the Database Triggers handout) creates the ledger_bef_upd_ins_row trigger. Your job is to add one or more after triggers that inserts a row into the LEDGER_TRANS_LOG table after either an insertion, update, or deletion operation is performed on the LEDGGER table. Except as mentioned below, you do not need to modify the trigger stored in S23-trigex03. Instead, I want you to create one trigger (that handles insertions, updates, and deletions) or three triggers (one to handle insertions, one to handle updates, and one to handle deletions). Each row in the LEDGER_TRANS_LOG table should look something like the following: ( row in LEDGER at ' te char (sysdate, ' mm/dd/ /yyXX hhimiiss.')); depending upon whether an insert, update, or delete operation was performed. In other words, if an insertion is taking place, the row would begin (Inserting row in LEDGER ...). If an update takes place, the row would begin (Updating row in LEDGER ....). The same thing goes for a deletion. For a row to be inserted into the LEDGER. TRANS LOGltable when an update occurs. only an update to RATE column is acceptable. In addition, given the requirements, you will find that one change to the ledger_bef_upd_ins_tow trigger stored in S23-trigex03.sql needs to be made. It is your choice as to whether you wish to create separate triggers for insertions, updates, and deletions or one trigger to handle all three operations. In order to test your trigger(s), use the third file (S23triggertestdata.sqI) which consists of the following SQL statements: iosert into ledger values (' 2-nov-21', 2, 3, 3, 'BLAIR'); update ledger set amount =34 where person = 'TALBOT' ; iosert into ledger values ('e3-nov-21', 20, 20, 30, 'EVANS') update ledger set rate =16 where person = 'RUSSEY'; update ledger set rate =10 where person = ' KOCH ' ; update ledger set quantity =99 where person = "JoNES'; delete from ledger where person = ' KENTGEN '; SELECT * FROM LEDGER; SELECT * FROM LEDGER_AUDIT; SELECT * FROM LEDGER_TRANS_LOG; This time around I am not going to suggest what the content of the LEDGER, LEDGER_AUDIT, and LEDGER_TRANS_LOG tables should be after testing your triggers. So let's not submit anything until we are confident that the triggers working properly. Comment Please note that while testing your trigger(s) you will from time to time have to recreate the LEDGER, LEDGER AUDIT, and LEDGER TRANS LOG tables. Whenever you do so, you will also need to re-create all triggers that have to do with these tables. MIS 4386 PL/SQL Trigger Opportunity No. 1 SQL> select * from ledger; I PL/SQL Trigger Opportunity No. 1 gives you an opportunity to work with a revised version of the LEDGER and LEDGER_AUDIT tables. A third table has also been added to the mix: the LEDGER_TRANS_LOG table. SQL> set feedback on 5 rows selected. SQL> drop table ledger cascade constraints; SQL> create table ledger.audit (actiondate date, Table dropped. 2 guantitx number, rate number, amount number (9,2), 3 person varchar2(25)); SQL> drop table ledger. audit cascade constraints; Table created. Table dropped. SQL> drop table ledgen trans.log cascade constraints; Table dropped. SQL> create table ledger (actiondate date primary key, 2 quantitx number, rate number, amount number (9,2), 3 persen varchar2(25)); Table created. SQL> insert into ledger values (' 1APR20 ', 1, 3, 3, 'KOCH' ); 1 row created. SQL> insert into ledger values (' 2 MAY-20', 1, 1, 2, 'JONES'); 1 row created. SQL> insert into ledger values (' 03 -JUN-20', 1, 1, 2, 'TALBOT'); 1 row created. SQL> insert into ledger values (' 4JAN20 ', 1, 1, 2, 'KENTGEN'); 1 row created. SQL> insert into ledger values (' 84FEB20 ', ..5, 1, 1, 'TALBOT'); 1 row created

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

Lean Audit The 20 Keys To World Class Operations A Health Check For Factory And Office

Authors: Joerg Muenzing

1st Edition

1514817829, 978-1514817827

More Books

Students also viewed these Accounting questions

Question

Explain basic guidelines for effective multicultural communication.

Answered: 1 week ago

Question

Identify communication barriers and describe ways to remove them.

Answered: 1 week ago

Question

Explain the communication process.

Answered: 1 week ago