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

Oracle SQL Create a script that uses a database trigger to output messages that

ID: 3708360 • Letter: O

Question

Oracle SQL

Create a script that uses a database trigger to output messages that describe the records that are entered into a table. The script must perform the following:

Create a database trigger, "emp_insert_t1" that will display a message for each record that has been entered into the "emp" table. The message should contain the employee number, employee name and the employee salary. The following is an example of an output message.


"Record entered for employee Jackson with employee number 1234 and salary 25000"

Insert 10 records into the "emp" table.

Explanation / Answer

CREATE TRIGGER emp_insert_t1 AFTER INSERT ON emp [ FOR EACH ROW ] DECLARE BEGIN insert into emp values (:new.num, :new.name, :new.salary); DBMS_OUTPUT.PUT_LINE('Record entered for employee Jackson with employee number '+new.num+' and salary '+new.salary); END; INSERT INTO emp VALUES (301, 'Mary', '20000'); INSERT INTO emp VALUES (302, 'Mary', '20000'); INSERT INTO emp VALUES (303, 'Mary', '20000'); INSERT INTO emp VALUES (304, 'Mary', '20000'); INSERT INTO emp VALUES (305, 'Mary', '20000'); INSERT INTO emp VALUES (306, 'Mary', '20000'); INSERT INTO emp VALUES (307, 'Mary', '20000'); INSERT INTO emp VALUES (308, 'Mary', '20000'); INSERT INTO emp VALUES (309, 'Mary', '20000'); INSERT INTO emp VALUES (310, 'Mary', '20000');

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