René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Ref cursors [PL/SQL]

create table rc_tbl (a number, b varchar2(10));

insert into rc_tbl values (1, 'one');
insert into rc_tbl values (2, 'two');
insert into rc_tbl values (3, 'three');

create or replace procedure rc_proc(rc in out sys_refcursor) as
begin
  open rc for select * from rc_tbl;
end;
/

variable rc_var refcursor

begin rc_proc(:rc_var); end;
/

print rc_var

drop table rc_tbl;
drop procedure rc_proc;

Links