MSCEWI3101

Specific For Loop Clause Is Currently Not Supported By Snowflake Scripting

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

Severity

Low

Description

Oracle allows additional clauses to the FOR LOOP condition. Like the BY, WHILE, and WHEN clauses. Both WHILE and WHEN clauses allow for an extra boolean expression as a condition. While the BY clause allows a stepped increment in the iteration. These additional clauses are not supported in Snowflake Scripting and are ignored during transformation.

Example Code

Input Code:

CREATE OR REPLACE PROCEDURE P2
AS
BEGIN
FOR i IN 1..10 WHILE i <= 5 LOOP
    NULL;
END LOOP;

FOR i IN 5..15 BY 5 LOOP
    NULL;
END LOOP;
END;

Output Code:

CREATE OR REPLACE PROCEDURE PUBLIC.P2 ()
RETURNS VARCHAR
LANGUAGE SQL
EXECUTE AS CALLER
AS
$$
   BEGIN
      /*** MSC-WARNING - MSCEWI3101 - FOR LOOP WITH "WHILE" CLAUSE IS CURRENTLY NOT SUPPORTED BY SNOWFLAKE SCRIPTING ***/
      FOR i IN 1 TO 10 LOOP
         NULL;
     END LOOP;
      /*** MSC-WARNING - MSCEWI3101 - FOR LOOP WITH "BY" CLAUSE IS CURRENTLY NOT SUPPORTED BY SNOWFLAKE SCRIPTING ***/
      FOR i IN 5 TO 15 LOOP
         NULL;
     END LOOP;
   END;
$$;

Recommendations

Last updated