创建测试表:
create table bill
(id int,
status int,
aacount varchar2(1));
一条测试数据:
insert into bill values (1,49,'N');
commit;
创建触发器:
create or replace trigger t_update_bill
before insert or update on bill
for each row
begin
if :new.status=50
then :new.aacount:='Y';
end if;
end;
测试1:
将id=1那条数据的status改成50,然后检查结果(请自行测试,我这边验证无误了):
update bill set status=50 where id=1;
commit;
测试2:
插入一条id=2,status为50,account为N的数据(请自行测试,我这边验证无误了):
insert into bill values (2,50,'N');
commit;