MSCEWI4035

Declaring a Cursor Variable that it is never initialized is not supported.

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

Severity

Medium

Description

Currently, a Cursor Variable that is declared but never initialized is not supported by SnowFlake. Thus, the EWI is added, and the code commented out.

Code Example

Input Code:

CREATE OR ALTER PROCEDURE notInitializedCursorTest
AS
BEGIN
    -- Should be marked with MSCEWI4035
    DECLARE @MyCursor CURSOR, @MyCursor2 CURSOR;
    -- Should not be marked
    DECLARE cursorVar CURSOR FORWARD_ONLY STATIC READ_ONLY
        FOR
        SELECT someCol
        FROM someTable;
    RETURN 'DONE';
END;

Output Code:

CREATE OR REPLACE PROCEDURE PUBLIC.notInitializedCursorTest ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
    DECLARE
-- ** MSC-ERROR - MSCEWI4035 - CURSOR VARIABLE DECLARED BUT NEVER INITIALIZED, THIS IS NOT SUPPORTED IN SNOWFLAKE SCRIPTING **
--        -- Should be marked with MSCEWI4035
--        MYCURSOR CURSOR;
-- ** MSC-ERROR - MSCEWI4035 - CURSOR VARIABLE DECLARED BUT NEVER INITIALIZED, THIS IS NOT SUPPORTED IN SNOWFLAKE SCRIPTING **
--        MYCURSOR2 CURSOR;
        -- Should not be marked
        cursorVar CURSOR
        FOR
            SELECT
                someCol
            FROM
                PUBLIC.someTable;
    BEGIN
        RETURN 'DONE';
    END;
$$;

Recommendations

Last updated