Oracle SQL Create a script that uses a database trigger to output messages that
ID: 3707605 • 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
Answer:(Hope this helps you)
The message contains the employee number, employee name and the employee salary
The query can be written as :
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||' andsalary '||:NEW.EMP_SALARY);
END;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.