具体问题描述:
A表和B表字段完全相同,A表中插入数据且A表中status=1时该数据插入到B表中,数据在B表中当字段status=0时就执行删除该条数据
下面是我写的代码,现在实现了A表中的数据全部插入到B表中了,其实应该有一个status=1在插入B表中,这我没实现,还有一个是当B表status=0时,该数据就删除了,这个我也没实现,有会的大神们帮帮忙
create or replace trigger AB_DML_TGR
after insert
on CARUSER_FINANCE
for each row
declare
V_NUM number;
begin
V_NUM := 0;
select count(*) into V_NUM from ARREARAGE_MANAGER M
where M.CARUSER_ID= :new.caruser_id;
if V_NUM = 0 then
if inserting then
insert into ARREARAGE_MANAGER
values
(:new.ID,
:new.CARUSER_ID,
:new.finance_status,
:new.balance,
:new.data_status,
:new.create_time,
:new.update_time,
:new.end_time,
:new.mes_owner,
:new.u_owner
);
end if;
elsif :new.finance_status=0 then
delete ARREARAGE_MANAGER t where t.finance_status=0;
end if;
end;