是的 行级触发器 下面只是个触发器的例子 改一下就能用 create or replace trigger t_insert after insert or delete or update on test for each rowbegin if inserting then insert into test_audit values(test_seq.nextval,user,'insert',:new.name);
elsif updating then insert into test_audit values(test_seq.nextval,user,'update',:new.name ||'_'||:old.name);
elsif deleting then insert into test_audit values(test_seq.nextval,user,'delete',:old.name); end if;
end;
create or replace trigger projectexpend_tigger after insert or delete on pt_project for each row begin if inserting then insert into pt_projectexpend(id,projectid,landid,taxpaterid,subject,pricetype) select projectexpend_sequence.NEXTVAL,:new.id,:new.landid,:new.taxpayerid,'土地征用及拆迁补偿费','土地出让金' from dualunion select projectexpend_sequence.NEXTVAL,:new.id,:new.landid,:new.taxpayerid,'土地征用及拆迁补偿费','土地契税' from dual; end if; end;我需要同时插入多条 这样写好像也不对啊
create or replace trigger t_insert
after insert or delete or update on test
for each rowbegin
if inserting then
insert into test_audit values(test_seq.nextval,user,'insert',:new.name);
elsif updating then
insert into test_audit values(test_seq.nextval,user,'update',:new.name ||'_'||:old.name);
elsif deleting then
insert into test_audit values(test_seq.nextval,user,'delete',:old.name);
end if;
end;
begin
if inserting then
insert into pt_projectexpend(id,projectid,landid,taxpaterid,subject,pricetype)
select projectexpend_sequence.NEXTVAL,:new.id,:new.landid,:new.taxpayerid,'土地征用及拆迁补偿费','土地出让金' from dualunion
select projectexpend_sequence.NEXTVAL,:new.id,:new.landid,:new.taxpayerid,'土地征用及拆迁补偿费','土地契税' from dual;
end if;
end;我需要同时插入多条 这样写好像也不对啊
自增列,使用序列(sequence)来实现。