MSCEWI3128

Boolean cursor attribute is not supported

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

Severity

Medium

Description

This message is used to indicate that a boolean cursor attribute is not supported in SnowScript or that there is no transformation that emulates its functionality in SnowScript. The following table shows the boolean cursor attributes that can be emulated:

Boolean Cursor AttributeStatus

%FOUND

Can be emulated

%NOTFOUND

Can be emulated

%ISOPEN

Not Supported

Example Code

Input Code

CREATE OR REPLACE PROCEDURE cursor_attributes_proc
IS
    is_open_attr BOOLEAN;
    found_attr BOOLEAN;
    my_record table1%ROWTYPE;
    CURSOR my_cursor IS SELECT * FROM table1;
BEGIN
    OPEN my_cursor;
    LOOP
        FETCH my_cursor INTO my_record;
        EXIT WHEN my_cursor%NOTFOUND;
        is_open_attr := my_cursor%ISOPEN;
        found_attr := my_cursor%FOUND;
    END LOOP;
    CLOSE my_cursor;
END;

Output Code

CREATE OR REPLACE PROCEDURE PUBLIC.cursor_attributes_proc ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
    DECLARE
        is_open_attr BOOLEAN;
        found_attr BOOLEAN;
        my_record OBJECT /*** MSC-WARNING - MSCEWI1036 - ROWTYPE DATA TYPE CONVERTED TO OBJECT ***/ := OBJECT_CONSTRUCT();
        my_cursor CURSOR
        FOR
            SELECT
                OBJECT_CONSTRUCT( *) sc_cursor_record FROM
                PUBLIC.table1;
    BEGIN
        OPEN my_cursor;
        LOOP
            FETCH my_cursor INTO my_record;
            IF (my_record IS NULL) THEN
                EXIT ;
            END IF;
            is_open_attr := null /*my_cursor%ISOPEN*/ /*** MSC-ERROR - MSCEWI3128 - BOOLEAN CURSOR ATTRIBUTE %ISOPEN IS NOT SUPPORTED IN SNOWFLAKE ***/;
            found_attr := my_record IS NOT NULL;
        END LOOP;
        CLOSE my_cursor;
    END;
$$;

Recommendations

Last updated