这是我写的一段PL/SQL的触发器代码,每次更新sell表里的salesvoulme时,都触发更新shop表里amountcreate trigger update_shop
after update of salesvolume on sell for each row
begin
update shop
set amount=(:new.salesvolume)*product.sellingprice where 
shop.shopnumber=:new.shopnumber and :new.productnumber=product.productnumber;
end update_shop;
/ 为什么编译总是出错,问题出在何处????
PS:sell表里有(prodctnumber,shopnumber,salesvolume)
   shop表里有(shopnumber,amount)
   product表里有(productnumber,sellingprice)谢谢大家帮忙解答一下~~~~该如何修改

解决方案 »

  1.   

    --------你的product表都没在SQL里定义。create trigger update_shop
    after update of salesvolume on sell for each row
    begin
    update shop
    set 
        amount=(:new.salesvolume)*(select sellingprice from product     where :new.productnumber=product.productnumber)
    where  
    shop.shopnumber=:new.shopnumber;
    end update_shop;
    /