Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 647 Bytes

Ex-15.md

File metadata and controls

31 lines (26 loc) · 647 Bytes

PL/SQL Triggers

Create Table trigger

create or replace trigger salarychange
        before  insert or update on employee
        for each row
        when (new.eno>0)
      declare
    sal_diff number;
        begin
        sal_diff:=:new.sal - :old.sal;
    dbms_output.put_line('Old Salary = '|| :old.sal);
    dbms_output.put_line('New Salary = '|| :new.sal);
    dbms_output.put_line('Salary Difference = '|| sal_diff);
        end;
    /
select * from employee;
insert into employee(eno,ename,dept,sal) values (6,ígirií,ícsí,5000);
update employee set sal=sal+500 where eno=102;