1.创建表
create table depart
(id int,
status int,
aacount varchar2(1));
insert into departvalues (1,30,'N');
commit;
2.创建修改触发器
1)plsql
create or replace trigger update_depart
before insert or update on depart
for each row
begin
if :new.status=50
then :new.aacount:='Y';
end if;
end;
2)navcat
navcat有时会报:Err] ORA-24344: success with compilation error;解决办法:最后的end不要单独放一行
create or replace trigger update_depart
before insert or update on depart
for each row
begin
if :new.status=50
then :new.aacount:='Y';
end if;end;
3.测试
update depart set status=50 where id=1;