Refcursor Output
-- Get refcursor output: 
-- Data is output from Oracle database to external applications using refcursor. 
-- When the procedure is executed, all we see is the message 

-- PL/SQL procedure successfully completed.

-- Shown below is a way to see what is output to external systems.

SET TIMING ON;    --optional

CREATE OR REPLACE PROCEDURE p_op_ref_cursor(o_refcur  OUT  SYS_REFCURSOR)
IS
BEGIN
 OPEN o_refcur
  FOR 'SELECT  TO_DATE(201409,''yyyymm'')  ref_date FROM DUAL';
END p_op_ref_cursor;
/

-- Calling the procedure
VAR  o_rc  refcursor;
DECLARE o_rc  SYS_REFCURSOR;
BEGIN  p_op_ref_cursor(o_refcur=>:o_rc);
END;
/

PRINT o_rc;

Refcursor Output


-- This is only for demo/POC

DROP PROCEDURE p_op_ref_cursor;


   SQL Functions    Dual Table Queries
   Data Output by refcursor    Refcursor Input

Oracle registered trademark of Oracle Corporation.

Last Revised On: September 20th, 2014

  23864