Set the REFCURSOR variable to the results of a SELECT statement, and print out the REFCURSOR variable : Reference Cursor « Cursor « Oracle PL / SQL






Set the REFCURSOR variable to the results of a SELECT statement, and print out the REFCURSOR variable

  

SQL>
SQL> SET ECHO OFF
SQL>
SQL> VARIABLE l_table_list REFCURSOR
SQL>
SQL> 
SQL> BEGIN
  2    OPEN :l_table_list FOR
  3       SELECT table_name FROM user_tables;
  4  END;
  5  /

PL/SQL procedure successfully completed.

SQL>
SQL> 
SQL> PRINT l_table_list
COURSE
EMP_AUDIT
MYTABLE1
MYLOG
P
SYSTEM_STATS
INVENTORY_TBL
DEPT$AUDIT
PASSWORD_AUDIT
EMP_DELTAS
CUSTLOG
DEMO
CUST_NO_KEY_TABLE
IT
P1
MYSTATS
WORKING_EMPS
WORKING_EMPLOYEES
EMPTEMPTABLE
TEMP_TABLE
EMPLOYEETEMPTABLE
TMP
PARMS
IX
CUST_WITH_VARRAY_TEMP_TABLE
WORKING_CUSTOMERS

26 rows selected.

SQL>
SQL>
SQL>

   
    
  








Related examples in the same category

1.Define and use reference cursor
2.Defines and declares a reference cursor before explicitly opening it
3.REF CURSOR custom type
4.Reference cursor demo
5.Reference value in a cursor by cursor variable
6.refcursor variable