Question: Use the product table from this module (do not modify table or column names) and modify the EventLog trigger that it will store all changed
Use the product table from this module (do not modify table or column names) and modify the EventLog trigger that it will store all changed (deleted or updated) values from the Product table in the ProductHistory table. Provide the code of your working trigger and code you used to create the ProductHistory table.
ProductTable From Module:
CREATE TABLE ProductTable(
ProductID INTEGER NOT NULL,
ProductName VARCHAR2(50) NOT NULL,
ListPrice NUMBER(10,2),
Category INTEGER NOT NULL
);
/
INSERT INTO ProductTable VALUES(299,'Chest',99.99,10);
INSERT INTO ProductTable VALUES(300,'Wave Cruiser',49.99,11);
INSERT INTO ProductTable VALUES(301,'Megaland Play Tent',59.99,11);
INSERT INTO ProductTable VALUES(302,'Wind-Up Water Swimmers',2.00,11);
INSERT INTO ProductTable VALUES(303,'Garmin Pocket or Vehicle GPS Navigator',609.99,12);
EventLog from the Module:
CREATE OR REPLACE TRIGGER eventLog
BEFORE UPDATE ON ProductTable
FOR EACH ROW
BEGIN
INSERT INTO SYSTEM.EVENTTABLE(eventID, productID, userUpdating, eventTime) values(seq.nextval,:old.productID, user, sysdate);
END;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
