declare out_select testpackage.test_cursor; ceshi emp%test; begin test_select(outcur); loop exit when outcur%notfound; fetch outcur into ceshi; dbms_output.put_line(ceshi.ename); end loop; end;
declare out_select testpackage.test_cursor; ceshi test%rowtype; begin test_select(outcur); loop exit when outcur%notfound; fetch outcur into ceshi; dbms_output.put_line(ceshi.ename); end loop; end;更正补充说明:上面变量定义随意取名,其中ceshi.ename也是随便写的,也就是说你必须的输出游标里的内容,不能直接输出游标。ename是字段名。
declare
out_select testpackage.test_cursor%type ;
beginend ;
另外dbms_output.put_line可以直接输出out_select ,有点多态的感觉啊。
ret testpackage.Test_CURSOR%type ;
begin
test_select(ret) ;
dbms_output.put_line(ret);
end ;
还是不对,报错为ORA-06550: 第 2 行, 第 9 列:
PLS-00206: %TYPE 必须用于变量, 列, 字段或属性, 而不是 'TESTPACKAGE.TEST_CURSOR'
ORA-06550: 第 2 行, 第 9 列:
PL/SQL: Item ignored
ORA-06550: 第 4 行, 第 17 列:
PLS-00320: 此表达式的类型声明不完整或格式不正确
ORA-06550: 第 4 行, 第 5 列:
PL/SQL: Statement ignored
ORA-06550: 第 5 行, 第 26 列:
PLS-00320: 此表达式的类型声明不完整或格式不正确
ORA-06550: 第 5 行, 第 5 列:
PL/SQL: Statement ignored
out_select testpackage.test_cursor ;
begin
test_select(out_select) ;
dbms_output.put_line(out_select);
end ;这个你是用来干什么???一个test_select 不就实现了你的用法吗
为什么还要把游标作为输出参数那?
怎样显示?
out_select testpackage.test_cursor;
ceshi emp%test;
begin
test_select(outcur);
loop
exit when outcur%notfound;
fetch outcur into ceshi;
dbms_output.put_line(ceshi.ename);
end loop;
end;
out_select testpackage.test_cursor;
ceshi test%rowtype;
begin
test_select(outcur);
loop
exit when outcur%notfound;
fetch outcur into ceshi;
dbms_output.put_line(ceshi.ename);
end loop;
end;更正补充说明:上面变量定义随意取名,其中ceshi.ename也是随便写的,也就是说你必须的输出游标里的内容,不能直接输出游标。ename是字段名。