当前位置: 代码迷 >> Oracle管理 >> 为何非限定的游标不能这样用
  详细解决方案

为何非限定的游标不能这样用

热度:94   发布时间:2016-04-24 04:19:13.0
为什么非限定的游标不能这样用?

declare 
  type c_dept is ref cursor ;
  c1 c_dept;
begin
  open c1 for select * from dept;
  
  --这里报错ORA-06550
  for t1 in c1 loop
    dbms_outPut.put_line(t1.deptno);
  end loop;
end;

------解决方案--------------------
引用:

declare 
  type c_dept is ref cursor ;
  c1 c_dept;
begin
  open c1 for select * from dept;
  
  --这里报错ORA-06550
  for t1 in c1 loop
    dbms_outPut.put_line(t1.deptno);
  end loop;
end;

for循环不用open游标
  相关解决方案