ASSIGNMENT
ASSIGNMENT
D.CHANDAN
Assignment 9 : Assignment-10
Consider the customer table as (cid number, name string, address string, salary
number).
1.Create an update trigger that displays salary changes for every salary updation in customer
table
CREATE OR REPLACE TRIGGER salary_update_notification
AFTER UPDATE OF salary ON customer
FOR EACH ROW
BEGIN
DBMS_OUTPUT.PUT_LINE('Customer ID: ' || :OLD.cid || ' - Salary changed from '
|| :OLD.salary || ' to ' || :NEW.salary);
END salary_update_notification;
/
HU22CSEN0100515
D.CHANDAN
2.Create a trigger that displays message if the employee table is accessed beyond office hours
(before 10am and after 5pm).
CREATE OR REPLACE TRIGGER employee_access_off_hours
BEFORE INSERT OR UPDATE OR DELETE OR SELECT ON employee
DECLARE
current_hour NUMBER;
BEGIN
current_hour := TO_NUMBER(TO_CHAR(SYSDATE, 'HH24'));
3.Create a statement level trigger and row level trigger for employee data insertion operation
CREATE OR REPLACE TRIGGER employee_insert_statement
AFTER INSERT ON employee
BEGIN
DBMS_OUTPUT.PUT_LINE('Employee data insert operation executed at the statement
level.');
END employee_insert_statement;
/