declare
 tempsal drp.t_client.name%type;
 cursor v_mycursor is select *from drp.t_client where id>tempsal;
 v_currecord v_mycursor%rowtype;
begin
  tempsal:=10000;
  open v_mycursor;
  fetch v_mycursor into v_currecord;
  while 
   v_mycursor%found
   loop
      dbms_output.put_line(v_currecord.name);
      fetch v_mycursor into v_currecord;
   end loop;
  close v_mycursor;
end;假如我去掉红色的那句,运行的时候就会报:buffer overflow, limit of 10000bytes
不去掉运行就正常了
但是我想问的是我前面不是已经把游标取出来了吗,后面循环的时候为什么还要去取

解决方案 »

  1.   

    dbms_output.put_line(v_currecord.name);应该是你输出的字符过长了 
    把这句注释掉试试
      

  2.   

    while 
      v_mycursor%found
    ----------------
    为什么用While 判断游标记录存在 ,open c_job;
             loop
               
               fetch c_job into c_row;           
               exit when c_job%notfound;
                dbms_output.put_line(c_row.empno||'-'||c_row.ename||'-'||c_row.job||'-'||c_row.sal);
             end loop;
           --关闭游标
          close c_job;