Y
yifeibbs
Unregistered / Unconfirmed
GUEST, unregistred user!
触发器有些错误,不能建立,错在哪里?
SET TERM !! ;
CREATE TRIGGER ip_store FOR ipsb
AFTER insert AS
DECLARE VARIABLE sid char(2);
BEGIN
select sid from ipsh where id=new.id into :sid;
if exists (select * from onhand where sid=:sid and pid=new.pid) then
update onhand
set oh4=oh4+amount4,
oh6=oh6+amount6,
oh8=oh8+amount8,
oh10=oh10+amount10,
oh12=oh12+amount12,
oh14=oh14+amount14,
oh16=oh16+amount16
where sid=:sid and pid=new.pid
else
INSERT INTO onhand(sid, pid, oh4, oh6, oh8, oh10, oh12, oh14, oh16)
VALUES sid,new.pid,new.oh4,new.oh6,new.oh8,new.oh10,new.oh12,new.oh14,new.oh16);
END !!
SET TERM ; !!
SET TERM !! ;
CREATE TRIGGER ip_store FOR ipsb
AFTER insert AS
DECLARE VARIABLE sid char(2);
BEGIN
select sid from ipsh where id=new.id into :sid;
if exists (select * from onhand where sid=:sid and pid=new.pid) then
update onhand
set oh4=oh4+amount4,
oh6=oh6+amount6,
oh8=oh8+amount8,
oh10=oh10+amount10,
oh12=oh12+amount12,
oh14=oh14+amount14,
oh16=oh16+amount16
where sid=:sid and pid=new.pid
else
INSERT INTO onhand(sid, pid, oh4, oh6, oh8, oh10, oh12, oh14, oh16)
VALUES sid,new.pid,new.oh4,new.oh6,new.oh8,new.oh10,new.oh12,new.oh14,new.oh16);
END !!
SET TERM ; !!