create package test_age
as
type t_sor is ref cursor;
end;
/
create procedure pro(p_table in varchar2,p_col in varchar2,p_rc out test_age.t_sor)
as
str varvhar2(100);
begin
str:='select '||p_col||' from '||p_table;
open p_rc for str;
end;
/
给你一个例子
create or replace procedure test
as
type ref_cursor is ref cursor;
your_cursor ref_cursor;
yourvar varchar2(8);
begin
open your_cursor for select 1 from dual;
loop
fetch your_cursor into yourvar;
exit when your_cursor%notfound;
end loop;
close your_cursor;
end test;
/