merge into在触发器的用法
各位大侠,我现在又这样一个行级触发器,当PICKLIST表里面有数据插入的时候,我就与其他表联合查询(见触发器语句),
当不满足条件的时候我就把数据插入到PICKLIST_BKUP表里面去,但是我编译这个语句的时候
错误(6,1): PL/SQL: SQL Statement ignored
错误(6,12): PL/SQL: ORA-00913: 值过多
触发器见下面
create or replace
trigger trig_picklist_backup
after insert on picklist
begin
merge into picklist_bkup
using (select CompList.AMOUNT-CompList.ERRORS-CompList.USED Amount, PickList.AMOUNTNEED,
PickList.COMPID,PickList.MCID,PickList.STATION,PickList.SLOT,PickList.SUBSLOT,PickList.PICKLISTID,PickList.STATUS,OperatorTrace."TIMESTAMP",
PickList.REELCOUNTER,PickList.COMPNAME,PickList.STOCKLOCATION from CompList
inner join PickList on CompList.CompID = PickList.CompID
inner join OperatorTrace on PickList.CompID = OperatorTrace.CompID
where operatortrace.ActionID = 302 ) b1
on (picklist_bkup.mcid = b1.mcid and picklist_bkup.station = b1.station and picklist_bkup.slot = b1.slot and picklist_bkup.subslot = b1.subslot and picklist_bkup.picklistid = b1.picklistid and picklist_bkup.reelcounter = b1.reelcounter)
when not matched then
insert values (b1.Amount, b1,amountneed,b1.compid,b1.mcid,b1.station,b1.slot,b1.subslot,b1.picklistid,b1.status,b1."timestamp",b1.reelcounter,b1.compname,b1.stocklocation);
end;
请大家帮我看下,谢谢。