日期:2014-05-17 浏览次数:20964 次
create or replace procedure myproc(mycur sys_refcursor)
as
type myArrType is table of student%rowtype index by pls_integer;
myArr myArrType;
begin
fetch mycur bulk collect into myArr;
for i in myArr.first..myArr.last loop
dbms_output.put_line(myArr(i).name
------解决方案--------------------
' : '
------解决方案--------------------
myArr(i).score);
end loop;
end;
SQL> var mycur refcursor;
SQL> begin
2 open :mycur for select * from student;
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> exec myproc(:mycur);
a : 7
b : 11
c : 9
d : 30
e : 10
f : 33
g : 51
h : 39
i : 88
j : 46
PL/SQL procedure successfully completed.
SQL>