Tuesday, March 21, 2017

CREATE OR REPLACE PROCEDURE test for REF CURSOR

CREATE OR REPLACE PROCEDURE test
IS
  TYPE ref_cursor_type IS REF CURSOR;
  c_ref_cursor ref_cursor_type;
  v_sql VARCHAR2(1000) := 'SELECT 1 FROM some_object';
  v_dummy NUMBER;
BEGIN
  OPEN c_ref_cursor FOR v_sql;
  FETCH c_ref_cursor INTO v_dummy;
  CLOSE c_ref_cursor;
END;

No comments: