oracle游标取数据是不是显示打开游标

oracle游标取数据是否显示打开游标

create or replace procedure test_cursor_proce
is
cursor test_cursor is select * from test_table;
test_record test_table%rowtype;
begin
     --1.loop... fetch 游标必须手动显示open
     loop
        fetch test_cursor into test_record ;
        dbms_output.put_line(test_record.id || test_record.name);--运行时报错
    end loop;
end;


--2.for ... in 游标可以不用手动显示open
for test_cu in test_cursor loop
        dbms_output.put_line(test_cu.id || test_cu.name);--运行时正常取数
end loop;

  if test_cursor%isopen then 
    dbms_output.put_line('游标已打开。。。');
  else 
    dbms_output.put_line('游标未打开。。。');    
  end if; 
--输出结果为“游标未打开”


求大神对上述两种取数稍作解释。。尤其是for形式的取数,不太明了其原理,test_cu 是什么。。游标?但test_cu%notfound 报错。。。
------解决方案--------------------
引用:
网上找到的解释:
for 循环游标
循环游标隐式打开游标,自动滚动获取一条记录,并自动创建临时记录类型变量存储记录。处理完后自动关闭游标。


好像有道理


for 循环游标是不用OPEN的,而且test_cu 也不用定义类型的,在FOR的时候自动匹配游标。其实FOR循环游标使用是最方便的。
------解决方案--------------------
隐式的打开游标,或理解为不需要打开;
------解决方案--------------------
隐式游标,隐含了记录变量的定义、游标的打开、提取和关闭过程。test_cu 为隐含定义的记录变量,循环的执行次数与游标取得的数据的行数相一致。