Skip to content Skip to sidebar Skip to footer

Alternate Of Sys_refcursor

What is the alternate of sys_refcursor. After 12c upgrade, the resultset of sys_refcursor is unrecognizable by mulesoft/tibco. Reading it as null

Solution 1:

Use

TYPE cursor_type ISREFCURSOR;

or a strongly typed cursor:

CREATE PACKAGE SCHEMA_NAME.PACKAGE_NAME
AS
  TYPE Table_Name_Cursor ISREFCURSORRETURN SCHEMA_NAME.TABLE_NAME%ROWTYPE;

  -- You said this does not work.-- PROCEDURE get_Weakly_Typed_Cursor (--   out_cursor OUT SYS_REFCURSOR-- );PROCEDURE get_Strongly_Typed_Cursor (
    out_cursor OUT Table_Name_Cursor
  );
END;
/CREATE PACKAGE BODY SCHEMA_NAME.PACKAGE_NAME
ASPROCEDURE get_Strongly_Typed_Cursor (
    out_cursor OUT Table_Name_Cursor
  )
  ASBEGINOPEN out_cursor FORSELECT*FROM SCHEMA_NAME.TABLE_NAME;
  END;
END;
/

Solution 2:

You can define your own ref cursor type:

TYPE my_ref_cursor_type isREFCURSOR;
v_cursor my_ref_cursor_type;

But it would only make sense to do that if using a very old version of Oracle that didn't have SYS_REFCURSOR!

Post a Comment for "Alternate Of Sys_refcursor"