Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 1 . ( 2 0 points ) statement level Trigger. This question is based on table EMP. Recall that generally, there will be four

Q1.(20 points) statement level Trigger. This question is based on table EMP.
Recall that generally, there will be four steps for completing trigger related questions.
The first step, we will create a log table called Emp_Log as below:In the second step, you will create a statement level trigger named Emp_Update on table Emp. Whenever there is a command of update on the table Emp, the trigger will be fired, and one record will be added into the table Emp_log. Generally, the Updated_Date value will use the function SYSDATE, the Updated_by will be the current login name "User". You are free to define the string for action here.
Step third: after having successfully compiled the trigger, your program will run one Update command to test the trigger:
Update Emp set sal = sal *1.1 where deptno =20 ;
In the fourth step, you need to check the contents of Empl_log table, that will display the new records in the log table.
It will be a good practice, to remember to rollback after you get the display of the results:
Rollback;
DROP TRIGGER Emp_Update;
** You may notice that the "rollback" will cancel the update command on table EMP, also it will delete the correspondent record in the Emp_log table ( you do: Select * from Emp_log again after the roll back; you will see there is no record in that log table).
An advanced question: if you would like to keep the record in Emp_log file, even the triggering event (update) is cancelled, what you should do?(Refer to Note7c_Transactions, section 3, page 6-8).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions