PL/SQL触发器关于删除操作的疑问
发表于 : 2009-11-07 21:26
先上段代码
疑问是删除操作的时候,会有:new.idbasket么,不是只有:old.idbasket的么

代码: 全选
create or replace trigger product_inventory_trg
after delete or update on bb_basket
for each row
declare
cursor basketitem_cur is
select idproduct, quantity
from bb_basketitem
where idbasket=:new.idbasket;
begin
if updating then
for basketitem_rec in basketitem_cur loop
update bb_product
set stock = stock - basketitem_rec.quantity
where idproduct = basketitem_rec.idproduct;
end loop;
end if;
if deleting then
for basketitem_rec in basketitem_cur loop
update bb_product
set stock = stock + basketitem_rec.quantity
where idproduct=basketitem_rec.idproduct;
end loop;
end if;
end;