FETCH_BULK_RECORD_COLLECTIONS_UDF (OBJECT, FLOAT, ARRAY)

Definition

This user-defined function (UDF) is used to cover the functionality of fetch bulk records with different input parameters that determine the information added or the behavior of the cursor.

FETCH_BULK_RECORD_COLLECTIONS_UDF(CURSOR OBJECT, LIMIT FLOAT, COLUMN_NAMES ARRAY)

Parameters

CURSOR OBJECT

The cursor that is being processed.

LIMIT FLOAT

The limit of the row count.

COLUMN_NAMES ARRAY

The column names that are associated with the cursor.

Returns

Returns an object with the processed information.

Usage example

Input:

CREATE OR REPLACE TABLE BULKCOLLECTTABLE(test VARCHAR(100));
INSERT INTO BULKCOLLECTTABLE VALUES ('TEST_A');

CREATE OR REPLACE PROCEDURE MY_PROCEDURE ()
RETURNS OBJECT
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
    DECLARE
        MY_CURSOR OBJECT := INIT_CURSOR_UDF('MY_CURSOR', '   SELECT * FROM
      BULKCOLLECTTABLE');

    BEGIN
        MY_CURSOR := (
            CALL OPEN_BULK_CURSOR_UDF(:MY_CURSOR)
        );
        MY_CURSOR := (
            CALL FETCH_BULK_RECORD_COLLECTIONS_UDF(:MY_CURSOR, 1.0, NULL)
        );
        
        RETURN MY_CURSOR;
    END;
$$;

CALL MY_PROCEDURE();

Output:

{
  "FOUND": true,
  "ISOPEN": true,
  "NAME": "MY_CURSOR",
  "NOTFOUND": false,
  "QUERY": "   SELECT * FROM\n      BULKCOLLECTTABLE",
  "RESULT": {
    "TEST": [
      "TEST_A"
    ]
  },
  "ROWCOUNT": 1
}

Last updated