解决方案 »

  1.   

    这里的rowcount不是指的是总的记录数,而是指的当前游标所指的记录条数。declare
      cursor cr is
        select *
          from (select 1 id
                  from dual
                union
                select 2 from dual);
    begin
      open cr;
      dbms_output.put_line(cr%rowcount);
      close cr;
      for c1 in cr loop
        dbms_output.put_line(cr%rowcount);
      end loop;
    end;
      

  2.   

    写出来看SQL是什么;第二你的rowcount是放在哪里,怎么用的?
      

  3.   

      CURSOR t_Info IS
        select a.prtno,
               a.insuredname,
               a.insuredsex,
               a.insuredbirthday     
          from tml a,           
               (select insuredname,
                       insuredsex,
                       insuredbirthday,                 
                  from tml   where prtno = tPrtNo)  b
         where a.insuredname = b.insuredname
           and a.insuredsex = b.insuredsex
           and a.insuredbirthday = b.insuredbirthday);通过for循环调用
     FOR t_Info1 IN t_Info LOOP
       
        tAmnt := tAmnt +  f_slis_getinsure_sumamt(  t_Info1.Prtno );  
                                             END LOOP;tPrtNo为函数传进来的参数,这个参数能传进来,但是for循环里面的语句  tAmnt := tAmnt +  f_slis_getinsure_sumamt(  t_Info1.Prtno );  不执行。把tPrtNo的值写到下面的语句里,单独执行是有两条记录的。
     select a.prtno,
               a.insuredname,
               a.insuredsex,
               a.insuredbirthday     
          from tml a,           
               (select insuredname,
                       insuredsex,
                       insuredbirthday,                 
                  from tml   where prtno = tPrtNo)  b
         where a.insuredname = b.insuredname
           and a.insuredsex = b.insuredsex
           and a.insuredbirthday = b.insuredbirthday);