sql >> Database >  >> RDS >> Oracle

Alternatief van sys_refcursor

Gebruik

TYPE cursor_type IS REF CURSOR;

of een sterk getypte cursor:

CREATE PACKAGE SCHEMA_NAME.PACKAGE_NAME
AS
  TYPE Table_Name_Cursor IS REF CURSOR RETURN 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
AS
  PROCEDURE get_Strongly_Typed_Cursor (
    out_cursor OUT Table_Name_Cursor
  )
  AS
  BEGIN
    OPEN out_cursor FOR
    SELECT * FROM SCHEMA_NAME.TABLE_NAME;
  END;
END;
/


  1. Wat is de betekenis van SELECT... FOR XML PATH(' '),1,1)?

  2. Is BIGINT(8) het grootste gehele getal dat MySQL kan opslaan?

  3. Modellen genereren voor Flask-AppBuilder met flask-sqlqcodegen

  4. PDO matrixwaarden invoegen