SQL> create table tb_do_only(
2 id number primary key,
3 name varchar2(10)
4 );
Table created.
SQL> commit;
Commit complete.
SQL> insert into tb_do_only values(1001, 'tom');
1 row created.
SQL> insert into tb_do_only values(1002, 'tony');
1 row created.
SQL> insert into tb_do_only values(1003, 'david');
1 row created.
SQL> insert into tb_do_only values(1004, 'jack');
1 row created.
SQL> commit;
Commit complete.
二. 创建返回列表存储
SQL> create or replace package pkg_return_list as -- 创建包pkg_return_list及包的游标list_cursor, 该游标等下做pro_return_list的返回参数类型.
2 type list_cursor is ref cursor;
3 end pkg_return_list;
4 /
Package created.
SQL> create or replace procedure pro_return_list(p_cursor out pkg_return_list.list_cursor) is -- 创建存储过程pro_return_list, 并把p_cursor的类型定义为pkg_return_list.list_cursor.
2 begin
3 open p_cursor for select * from scott.tb_do_only;
4 end pro_return_list;
5 /