Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Oracle PL/SQL : The following table was created: CREATE TABLE audit_table (actio

ID: 3795396 • Letter: O

Question

Oracle PL/SQL:       The following table was created:   

CREATE TABLE audit_table

     (action              VARCHAR2(50),

       user_name      VARCHAR2(30) DEFAULT USER,

       last_change_date TIMESTAMP DEFAULT SYSTIMESTAMP);

A statement-level trigger was then created that inserted a row into the AUDIT_TABLE immediately after one or more rows have been added to the EMPLOYEES table.   The AUDIT_TABLE row contains the value 'Inserting' in the action column, whereas the other two columns contain their default values. The trigger has been tested via inserting a row into EMPLOYEES, and AUDIT_TABLE has been queried to see that it contains a row.

Q:    Make sure the trigger does not fire with a DELETE by deleting the employee record previously entered.   Then recheck the AUDIT_TABLE to make sure that there is not another new row.

Explanation / Answer

CREATE OR REPLACE
TRIGGER TRIG_EMP
AFTER INSERT ON EMPLOYEE
FOR EACH ROW
BEGIN
INSERT INTO AUDIT_TABLE (action)
VALUES ('Inserting');
END;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote