SQL> create or replace package pkg_table_collect as
2 type table_cursor is ref cursor;
3 end;
4 /
SQL> create or replace procedure sp_table_collect(tb_name in varchar2, collect_cursor out pkg_table_collect.table_cursor) is
2 v_sql varchar2(1000);
3 begin
4 v_sql := 'select * from ' || tb_name;
5 open collect_cursor for v_sql;
6 close collect_cursor;
7 end;
8 /
Procedure created
![](http://imgsrc.baidu.com/forum/w%3D580/sign=a494758e3101213fcf334ed464e636f8/531a865494eef01f13ad5992e8fe9925bd317d45.jpg)
2 type table_cursor is ref cursor;
3 end;
4 /
SQL> create or replace procedure sp_table_collect(tb_name in varchar2, collect_cursor out pkg_table_collect.table_cursor) is
2 v_sql varchar2(1000);
3 begin
4 v_sql := 'select * from ' || tb_name;
5 open collect_cursor for v_sql;
6 close collect_cursor;
7 end;
8 /
Procedure created
![](http://imgsrc.baidu.com/forum/w%3D580/sign=a494758e3101213fcf334ed464e636f8/531a865494eef01f13ad5992e8fe9925bd317d45.jpg)