I am supposed to create the code in SQL for the 3 Triggers using the information
ID: 647753 • Letter: I
Question
I am supposed to create the code in SQL for the 3 Triggers using the information on the table below.
Explanation / Answer
a)
create or replace trigger t1
after insert on copy for each row
declare
begin
update branch set totalvalue = totalvalue + (:old.copynum*:old.price) where branch = :old.branchnum;
end;
b)
create or replace trigger t2
after update on copy for each row
declare
begin
update branch set totalvalue = totalvalue + (:new.price - :old.price) where branch = :old.branchnum;
end;
c)
create or replace trigger t2
after delete on copy for each row
declare
begin
update branch set totalvalue = totalvalue - :new.price where branch = :old.branchnum;
end;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.