FETCH_BULK_RECORD_COLLECTIONS_UDF (OBJECT, INTEGER)

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

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 INTEGER)

Parameters

CURSOR OBJECT

The cursor that is being processed.

LIMIT INTEGER

The limit of the row count.

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, 0)
        );
        
        Return MY_CURSOR;
    END;
$$;

CALL MY_PROCEDURE();

Output:

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

Last updated