解决方案 »

  1.   

    缺少fetch into语句
    fetch into 完成之后才能通过 if curRand%notfound then判断
      

  2.   

    参考
    PROCEDURE s IS
      v_yhbh varchar2(10);
      v_yhmc varchar2(60);
      cursor bh_list is select distinct yhbh,yhmc from dbuser_manager order by yhmc ;
    begin
      open bh_list;
      fetch bh_list into v_yhbh,v_yhmc;
      while bh_list %found loop
       --你的操作
         fetch bh_list into v_yhbh,v_yhmc;
       end loop;
      close bh_list;
    END;
      

  3.   


    那if curRand%rowcount = 0 then也是因为缺少fetch into,所以才无法生效吗?
      

  4.   

    这个按说用不到游标的
    while numRowCount < 10 loop
       numRand := TRUNC(dbms_random.value(1,30),0);
       select count(1) into i from dc_middle_rand where midRand = numRand;
       if i=0 then
            EXECUTE IMMEDIATE 'Insert into dc_middle_rand values('|| numRand ||')';
            commit;
            numRowCount := numRowCount + 1;
         end if;
    end Loop;
      

  5.   

    %rowcount对于游标来说
    是指已经fetch出来 的行数,也就是提取的行数
      

  6.   

    select count(1) into v_num from dc_middle_rand where midRand = numRand;
    if(v_um>=1)
    用这个代替游标不行吗