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

Create a script that uses a database trigger to output messages that describe th

ID: 3706734 • Letter: C

Question

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

//The schema I used is IBISS and table is EMP. Please do replace with your schema to check this. I used oracle // with TOAD to test this

CREATE OR REPLACE TRIGGER IBISS.EMP_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;

dbms OUTPUT

============

Record entered for employee Ram with employee number 1 and salary 25000

Record entered for employee Shyamwith employee number 2 and salary 35000

Record entered for employee Alex with employee number 3 and salary 28000

Record entered for employee Peter with employee number 4 and salary 30000

Record entered for employee Samuel with employee number 5 and salary 40000

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