Ite 407 - Advanced Databases - Worksheet T-1 - Triggers: Trigger As SELECT Statements

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

ITE 407 – ADVANCED DATABASES - WORKSHEET T-1 – TRIGGERS

Creating and Using PL/SQL Triggers

Worksheet Activity

1. Using conditional predicates, modify secure_emp trigger from our previous


lecture to restrict all data manipulation events on the EMPLOYEES table to
hours between 08:00h and 17:00h, Sunday through Thursday.

2. Create a trigger to allow certain employees to be able to earn a salary of


more than 15,500. In this case, you will allow only the ‘AD_PRES’ and
‘AD_VP’ to access this privilege.

Use test data to attempt an update and include this in your uploaded
Trigger as SELECT statements.

3. Create a trigger called show_salary_change on the EMPLOYEES table to


shows the salary difference when a delete, insert, or update action is being
carried out. The trigger should record the values of the salary column before
the data changes by using the OLD and NEW qualifiers with the respective
column name. Subtract the old salary from the new salary in each case;
output ‘Old Salary’ <OLD sal>, ‘New Salary’ <NEW sal>, and ‘Difference
of salary’ <difference_sal>, each in its own output line.

I recommend you make a copy of the Employees table (EMP_CPY) to test


this trigger.

May 6, 2020

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy