MSCEWI4036

Snowflake Scripting only supports Local Cursors.

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Severity

Medium

Description

This EWI is added when Cursors other than Local Cursors are identified. Currently, Snowflake Scripting only supports Local Cursors. Thus, all Cursors are translated as Local Cursors.

Code Example

Input Code:

CREATE OR ALTER PROCEDURE globalCursorTest
AS
BEGIN
    -- Should be marked with MSCEWI4036
    DECLARE MyCursor CURSOR GLOBAL STATIC READ_ONLY
        FOR
        SELECT *
        FROM exampleTable;
    -- Should not be marked
    DECLARE MyCursor2 CURSOR LOCAL STATIC READ_ONLY
        FOR
        SELECT testCol
        FROM myTable;
    RETURN 'DONE';
END;

Output Code:

CREATE OR REPLACE PROCEDURE PUBLIC.globalCursorTest ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
    DECLARE
        -- Should be marked with MSCEWI4036
    /*** MSC-ERROR - MSCEWI4036 - SNOWFLAKE SCRIPTING ONLY SUPPORTS LOCAL CURSORS ***/
        MyCursor CURSOR
    FOR
        SELECT
            *
        FROM
            PUBLIC.exampleTable;
    -- Should not be marked
    MyCursor2 CURSOR
    FOR
        SELECT
            testCol
        FROM
            PUBLIC.myTable;
    BEGIN
        RETURN 'DONE';
    END;
$$;

Recommendations

Last updated