我建立了一个存储过程,其中部分代码如下:
 ( v_ProinsID number:=0)
as
begin
select actins_id into temp from t_actinst where proins_id=v_ProinsID and actdef_id=v_ActdefID;
  if sql%found then
     ....
  else
     ....
  end if
end;
问题:
   上面存储过程运行过程中,当select没有查到数据时,就会有下面的提示而不进行判断,请问如何解决?谢谢!!!
------------
ERROR 位于第 1 行:
ORA-01403: 未找到数据
ORA-06512: 在"DBO.PASSMIDDLEACT", line 4
ORA-06512: 在line 1   
-------------

解决方案 »

  1.   


     ( v_ProinsID number:=0)
    as
    begin
    select actins_id from t_actinst where proins_id=v_ProinsID and actdef_id=v_ActdefID;
      if sql%found then
         ....
      else
         ....
      end if
    end;先不要into temp,判断完了之后再into temp 
      

  2.   

    delphi
    ????错了地方呀!
      

  3.   

    可是去掉into temp就编译不过去了。
    顺便提一下,temp是我定义的一个临时变量。
      

  4.   

    使用@@ROWCOUNT:( v_ProinsID number:=0)
    as
    begin
    select actins_id into temp from t_actinst where proins_id=v_ProinsID and actdef_id=v_ActdefID;
      if @@ROWCOUNT <> 0
      begin
        if sql%found then
           ....
        else
           ....
        end if
      end
    end;
      

  5.   

    使用@@ROWCOUNT:( v_ProinsID number:=0)
    as
    begin
    select actins_id into temp from t_actinst where proins_id=v_ProinsID and actdef_id=v_ActdefID;
      if @@ROWCOUNT <> 0
      begin
        if sql%found then
           ....
        else
           ....
        end if
      end
    end;
      

  6.   

    可能是我没有说明白,这是oracle的存储过程!
    而且运行select 之后,没有数据之后就出现提示了。