REPEAT

Translation reference to convert Teradata REPEAT statement to Snowflake Scripting

Some parts in the output code are omitted for clarity reasons.

Description

Teradata's REPEAT statement is translated to Snowflake Scripting REPEAT syntax.

For more information on Teradata Repeat, check here.

[label_name:] REPEAT 
    { sql_statement }
    UNTIL conditional_expression
END REPEAT [label_name];

Sample Source Patterns

Teradata

IN -> Teradata_01.sql
CREATE PROCEDURE repeatProcedure(OUT resultCounter INTEGER)
BEGIN
    DECLARE counter INTEGER DEFAULT 0;
   
    customeLabel: REPEAT 
    	SET counter = counter + 1;
	UNTIL 10 < counter    
    END REPEAT customeLabel;
   
    SET resultCounter = counter;
END;

CALL repeatProcedure(:?);

Snowflake Scripting

OUT -> Teradata_01.sql
CREATE OR REPLACE PROCEDURE repeatProcedure (
--                                             OUT
                                                 RESULTCOUNTER INTEGER)
RETURNS VARIANT
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "teradata",  "convertedOn": "07/24/2024" }}'
EXECUTE AS CALLER
AS
$$
	DECLARE
		counter INTEGER DEFAULT 0;
	BEGIN
		 
		REPEAT
			counter := counter + 1;
		UNTIL (10 < counter)
		END REPEAT CUSTOMELABEL;
		resultCounter := counter;
		RETURN resultCounter;
	END;
$$;

CALL repeatProcedure(:?);

Known Issues

No issues were found.

No related EWIs.

Last updated