--案例:使用伪记录,在eml表中如果更新员工的工资,要求使用触发器 达到 工资只能增加不能降低
create or replace trigger update_emp
before update on emp
for each row
begin
if (:new.sal < :old.sal) then
:new.sal := :old.sal;
end if;
end;
select * from emp;
update emp set sal=1000 where empno=7369;
create or replace trigger update_emp
before update on emp
for each row
begin
if (:new.sal < :old.sal) then
:new.sal := :old.sal;
end if;
end;
select * from emp;
update emp set sal=1000 where empno=7369;