提示:ORA-24338:未找到语句句柄D中仅仅就是调用该存储过程。且存储过程F8没提示错误。
{在Oracle板块提问,没人回答}

解决方案 »

  1.   

    这个问题主要出现在使用数据库游标的时候.当执行存储过程,返回的游标没有打开时,可能会报这个错。
        游标没有打开的情况一般是忘记了写打开游标的语句,也可能是存储过程中执行出错,导致最后游标未打开。
    如:CREATE OR REPLACE package BODY PK_PROFU_GetMtStopTimesInfo
     is procedure GetMtStopTimesInfo
    (
         mMtName varchar2,
         mycs out mytype
    )
    as
     v_count int:=0;
        begin     select count(1) INTO v_count
         FROM WPStopTimesInfo t,MachineTools s
                     WHERE  s.matolname=mMtName  AND t.mtid=s.matolid;
         if(v_count>0) then
          open mycs for  select w.matolname , v.stoptimes
                         FROM WPStopTimesInfo v,MachineTools w
                         WHERE  w.matolname=mMtName  AND v.mtid=w.matolid
                         order by v.stoptimes desc ;     
         end if;    END;
     end;当上面的变量 v_count=0 时,将出现上述错误.将其修改成如下所示,问题解决:CREATE OR REPLACE package BODY PK_PROFU_GetMtStopTimesInfo
     is procedure GetMtStopTimesInfo
    (
         mMtName varchar2,
         mycs out mytype
    )
    as
     v_count int:=0;
        begin     select count(1) INTO v_count
         FROM WPStopTimesInfo t,MachineTools s
                     WHERE  s.matolname=mMtName  AND t.mtid=s.matolid;
         if(v_count>0) then
          open mycs for  select w.matolname , v.stoptimes
                         FROM WPStopTimesInfo v,MachineTools w
                         WHERE  w.matolname=mMtName  AND v.mtid=w.matolid
                         order by v.stoptimes desc ;
          else
            open mycs for select mMtName as matolname,1 as stoptimes  from dual;
                         
         end if;    END;
     end;
      

  2.   

    谢谢。问题估计找到了。怀疑是这处的问题   select Count(*) into p_Count
       from TMP_STOREDISRPT;
       if p_Count>1 then
          insert into TMP_STOREDISRPT(FORGNO,FDISSELAMT,FRETBUYAMT,FRETSELAMT)
          select '合计',sum(FDISSELAMT),sum(FRETBUYAMT),sum(FRETSELAMT)
          from TMP_STOREDISRPT;
       end if;而游标是这样的     if p_DataType='1' then
          open returnInfo for
            select a.forgno fsupno,b.faccountno,b.fsupname,fpayamt fpreamt,
               a.fnumber1 frecamt,a.fnumber2 finvcamt,famt
            from tmp_conaccrpt  a
            left join ts_supplier b on a.forgno=b.fsupno
            order by 1;
        else if p_DataType='2' then
              open returnInfo for
                select a.forgno,b.forgname,fpayamt fpreamt,
                   a.fnumber1 frecamt,a.fnumber2 finvcamt,famt
                from tmp_conaccrpt  a
                left join ts_organize b on a.forgno=b.forgno
                order by 1;
             end if;
        end if ;