案例:使用伪记录,在eml表中如果更新员工的工资,要求使用触发器 达到 工资只能增加不能降低

来源:互联网 发布:网王之知世年华 编辑:程序博客网 时间:2024/05/21 11:25
--案例:使用伪记录,在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;
阅读全文
0 0
原创粉丝点击