Connor and Chris will both be at AI World from October 12 to October 17 , the premier Oracle conference of 2025. If you're in Vegas, please come say Hi or pop into our sessions
Thanks for the question.
Asked: June 29, 2016 - 10:55 am UTC
Last updated: June 30, 2016 - 4:06 am UTC
Version: 11g
Viewed 1000+ times
SQL> drop table T purge; Table dropped. SQL> SQL> create table T ( sql_stmt varchar2(1000)); Table created. SQL> SQL> insert into t values ('select * from tab'); 1 row created. SQL> SQL> create or replace 2 procedure P(rc in out sys_refcursor) is 3 s varchar2(1000); 4 begin 5 select sql_stmt into s from t; 6 7 open rc for s; 8 end; 9 / Procedure created. SQL> SQL> variable rc refcursor SQL> exec p(:rc) PL/SQL procedure successfully completed. SQL> print rc V_TEST VIEW V4 VIEW V3 VIEW V2 VIEW V1 VIEW V VIEW T_TGT TABLE T_SOURCE TABLE T_PAR TABLE T_B TABLE T_A TABLE TEST_VIEW VIEW TEST_TAB_X TABLE ... 55 rows selected. SQL> SQL>
Check out more PL/SQL tutorials on our LiveSQL tool.
PL/SQL reference manual from the Oracle documentation library