refcursor varible
SQL> SQL> SQL> set echo on SQL> SQL> create table t as select * from all_users; Table created. SQL> SQL> variable x refcursor SQL> SQL> begin 2 open :x for select * from t; 3 end; 4 / PL/SQL procedure successfully completed. SQL> SQL> delete from t; 14 rows deleted. SQL> SQL> commit; Commit complete. SQL> SQL> print x USERNAME USER_ID CREATED ------------------------------ ---------- -------------------- JAVA2S 44 13-JUN-2008 20:30:45 FLOWS_020100 35 07-FEB-2006 22:52:43 FLOWS_FILES 34 07-FEB-2006 22:52:43 HR 33 07-FEB-2006 22:51:21 MDSYS 32 07-FEB-2006 22:44:47 ANONYMOUS 28 07-FEB-2006 22:40:15 XDB 27 07-FEB-2006 22:40:14 CTXSYS 25 07-FEB-2006 22:38:38 DBSNMP 23 07-FEB-2006 22:35:21 TSMSYS 20 07-FEB-2006 22:27:15 DIP 18 07-FEB-2006 22:17:03 OUTLN 11 07-FEB-2006 22:10:24 SYSTEM 5 07-FEB-2006 22:10:13 SYS 0 07-FEB-2006 22:10:13 14 rows selected. SQL> SQL> drop table t; Table dropped. SQL> SQL> --