CLOSE_BULK_CURSOR_UDF

Definition

This user-defined function (UDF) deletes the temporary table that stores the result set of the cursor and resets the cursor properties to their initial state.

CLOSE_BULK_CURSOR_UDF(CURSOR OBJECT)

Parameters

CURSOR OBJECT

The cursor that is checked and closed.

Returns

Returns an object with the cursor properties reset.

Migration example

Input:

-- [procedure initial logic]
CLOSE C1;
-- [procedure ending logic]

Output:

C1 := (
            CALL CLOSE_BULK_CURSOR_UDF(:C1)
        );

Usage example

Input:

CREATE OR REPLACE TABLE BULKCOLLECTTABLE(test VARCHAR(100));

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 CLOSE_BULK_CURSOR_UDF(:MY_CURSOR)
        );

        RETURN MY_CURSOR;
    END;
$$;

Output:

{
  "FOUND": null,
  "ISOPEN": false,
  "NAME": "MY_CURSOR",
  "NOTFOUND": null,
  "QUERY": "   SELECT * FROM\n      BULKCOLLECTTABLE",
  "ROWCOUNT": -1
}

Last updated