update of 列名 for each row是连起来用的。语句级触发器没有for each row
drop trigger 触发器名
例子(语句级)
当在休息日与非9点到17点之间的时候,禁止对emp表进行插入操作
create or replace trigger securityTriggerbefore insert on empdeclarepday varchar2(10);phour number(20);beginselect to_char(sysdate,'day') into pday from dual;select to_char(sysdate,'hh24') into phour from dual;if(pday in ('星期六','星期日') or (phour not between 9 and 17)) thenraise_application_error('-20666','禁止操作');end if;end;/
例子(行级)
当对每一行的工资进行修改的时候,新的工资不能小于原来的工资
create or replace trigger checkSalayTriggerbefore update of sal on emp for each rowbeginif :new.sal < :old.sal thenraise_application_error('-20555','工资不能减少');end if;end;/