if(numrows>0) then
  select itemshouldcost-overcost into numrows from item_income_fpd where id=:new.id;
  update item_income_fpd set notcost=numrows where itemcode=:new.itemcode;
  end if;请问我在触发这个的时候,为什么第一行的if报错,感觉是if里面不能判断数字的比较,哪位高手指引一下,谢谢

解决方案 »

  1.   

    是不是少了 else?if(numrows>0) then
     select itemshouldcost-overcost into numrows from item_income_fpd where id=:new.id;
    else
     update item_income_fpd set notcost=numrows where itemcode=:new.itemcode;
    end if;
      

  2.   

    select itemshouldcost-overcost into numrows from item_income_fpd where id=:new.id;后面加上no_data_found异常处理
      

  3.   

    item_income_fpd 是你触发事件的那个表吗?
      

  4.   

    把报错的具体信息贴出来
    感觉可能是cenlmmx(学海无涯苦作舟) 说得No_Data_Found导致得错误
      

  5.   

    另外你可以使用Merge来进行 查询更新得操作