触发器中的第一条语句引起异常(在ord_attemper_head表中无满足条件的记录),必须用exception来捕获异常,不能用sql%notfound来判断。

解决方案 »

  1.   

    先试一下,看有没有值?
    select count(*) from ord_attemper where attemper='d080304012' and trim(item_code)='24320400011901883';
      

  2.   

    实际上数据库中时存在记录的,也就是第一条语句不会找不到记录:
    ======================================
    SQL> select location from ord_attemper_head
      2  where (location is not null)
      3    and attemper='d080304012'
      4    and cause_code='z080' and rownum=1;LOCATION
    ----------
    d005
      

  3.   

    SQL> select count(*) from ord_attemper
      2  where attemper='d080304012'
      3    and trim(item_code)='24320400011901883';  COUNT(*)
    ----------
             1
      

  4.   

    select location into plocation from ord_attemper_head
          where (location is not null) and attemper=:new.attemper and cause_code=:new.cause_code and rownum=1;delete触发器应该用:old,而不是:new两个名字是一个人吗?
      

  5.   

    先删除ord_attemper_head表中的此条记录后,再试试删除主表中的那条记录。
      

  6.   

    cause_code=:new.cause_code and rownum=1;
    ???
    这么简单!!
    气死我了。我检查了一边这个问题
    发现下面的都没错
    唯独没发现这个!!