create or replace package mytest is -- Author : ADMINISTRATOR -- Created : 2008-5-13 11:19:28 -- Purpose : test TYPE record_type IS RECORD( code VARCHAR2(18), p_name VARCHAR2(16)); TYPE ref_cur_type IS REF CURSOR; end mytest;===========================请问一下 这个。 TYPE ref_cur_type IS REF CURSOR;是干嘛的》????
定义一个类型名称为ref_cur_type 的动态游标
参考动态游标
http://blog.csdn.net/qfs_v/archive/2008/05/06/2404794.aspx
http://blog.csdn.net/lzzyok/archive/2008/04/24/2324566.aspx
--type ref_cur_type is ref cursor 就是定义一个动态游标;
/*看了下面的代码就很清楚了*/
declare
type ref_cur_type is ref cursor;
ref_cur ref_cur_type;
re_test test%rowtype;
begin
open ref_cur for select * from test;
loop
fetch ref_cur into re_test ;
exit when ref_cur%notfound;
dbms_output.put_line(re_test.name);
end loop;
close ref_cur;
end;