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

In SQL developer, create a script that uses a database trigger to output message

ID: 3707291 • Letter: I

Question

In SQL developer, 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

Solution:

The query is given below:

CREATE OR REPLACE TRIGGER IBISS.enp_insert_t1
AFTER INSERT
ON IBISS.emp
FOR EACH ROW
BEGIN
dbms_output.put_line('Record entered for employee '||:NEW.EMP_NAME||' with employee number '||:NEW.EMP_NO||' and salary '||:NEW.EMP_SALARY);
END;

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

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