Consider the COMPANY database described in Figure 3.6. Using the syntax of Oracle triggers, write active rules to do the following:

(a) Whenever an employee’s project assignments are changed, check if the total hours per week spent on the employee’s projects are less than 30 or greater than 40; if so, notify the employee’s direct supervisor.

(b) Whenever an EMPLOYEE is deleted, delete the PROJECT tuples and DEPENDENT tuples related to that employee, and if the employee is managing a department or supervising any employees, set the MGRSSN for that department to null and set the SUPERSSN for those employees to null.


(a) We assume that a procedure TELL_SUPERVISOR(ARGSSN) has been created. This procedure looks for an employee whose SSN matches the procedure’s AGRSSN argument and it notifies the supervisor of that employee.
CREATE TRIGGER INFORM_SUPERVISOR_ABOUT_HOURS
AFTER UPDATE OF HOURS ON WORKS_ON
FOR EACH ROW
WHEN ((SELECT SUM(HOURS)
FROM WORKS_ON
WHERE ESSN = NEW.ESSN) < 30
OR
(SELECT SUM(HOURS)
FROM WORKS_ON
WHERE ESSN = NEW.ESSN) > 40)
TELL_SUPERVISOR (NEW.ESSN);

(b) CREATE TRIGGER DELETE_IN_CASCADE
AFTER DELETE ON EMPLOYEE
FOR EACH ROW
BEGIN
DELETE FROM WORKS_ON
WHERE ESSN = OLD.SSN;
DELETE FROM DEPENDENT
WHERE ESSN = OLD.SSN;
UPDATE EMPLOYE
SET SUPERSSN = ‘null’
WHERE SUPERSSN = OLD.SSN;
END;

Computer Science & Information Technology

You might also like to view...

_____ compression refers to the type of compression method in which the amount of time and the complexity required to compress and decompress are significantly different.

A. Asymmetric B. Lossless C. Lossy D. Spatial E. Temporal

Computer Science & Information Technology

When a thread executing a synchronized statement (or method) completes or satisfies the condition on which another thread may be waiting, it can call Object method ________ or ________ to allow a waiting thread or all waiting threads to transition to the runnable state again.

a. notifyThread, notifyAllThreads b. wakeUpThread, wakeUpAllThreads c. notify, notifyAll d. None of the above.

Computer Science & Information Technology

Case Based Critical Thinking QuestionsCase 6-1Carlos has created several tables for his Organic Produce farm database including Customers, Vendors, and Products. Now he wants to create forms that will make it easier to enter data in the database. Determine the best methods for Carlos to use when creating forms for his specific needs. To add the control to the form that meets his requirements, Carlos will use the ____ from the Design tab in the Forms Layout Group on the Ribbon.

A. Property Sheet B. Design Wizard C. Controls gallery D. Form Properties

Computer Science & Information Technology

Because nodes on a wireless network can?t easily detect collisions, which protocol is an option to transfer data over a network?

What will be an ideal response?

Computer Science & Information Technology