MSCEWI4037

Snowflake Scripting Cursors are non-scrollable.

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

This EWI is deprecated, please refer to the MSCINF0026 documentation.

Severity

Medium

Description

Snowflake Scripting Cursors are non-scrollable. Currently, only FETCH NEXT is supported.

Code Example

Input Code:

CREATE OR ALTER PROCEDURE scrollablecursorTest
AS
BEGIN
    -- Should be marked with MSCEWI4037
    DECLARE CursorVar CURSOR SCROLL STATIC READ_ONLY
	FOR  
	SELECT FirstName
	FROM vEmployee;
    -- Should not be marked
    DECLARE CursorVar2 CURSOR STATIC READ_ONLY
	FOR  
	SELECT FirstName
	FROM vEmployee;
    DECLARE CursorVar3 CURSOR FORWARD_ONLY STATIC READ_ONLY
	FOR  
	SELECT FirstName
	FROM vEmployee;
    RETURN 'DONE';
END;

Output Code:

CREATE OR REPLACE PROCEDURE PUBLIC.scrollablecursorTest ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
    DECLARE
        -- Should be marked with MSCEWI4037
    /*** MSC-ERROR - MSCEWI4037 - SNOWFLAKE SCRIPTING CURSORS ARE NON-SCROLLABLE, ONLY FETCH NEXT IS SUPPORTED ***/
    CursorVar CURSOR
    FOR
        SELECT
            FirstName
        FROM
            PUBLIC.vEmployee;
    -- Shouid not be marked
    CursorVar2 CURSOR
    FOR
        SELECT
            FirstName
        FROM
            PUBLIC.vEmployee;
    CursorVar3 CURSOR
    FOR
        SELECT
            FirstName
        FROM
            PUBLIC.vEmployee;
    BEGIN
        RETURN 'DONE';
    END;
$$;"

Recommendations

Last updated