GOTO
Translation reference for the conversion of Goto command to Snowflake Scripting
Description
The BTEQ Goto command skips over all intervening BTEQ commands and SQL statements until a specified label is encountered, then resumes processing as usual. (Teradata Basic Query Reference Goto Command)
.GOTO LabelName;Sample Source Patterns
Basic GOTO example
Snowflake scripting doesn't have an equivalent statement for Teradata BTEQ Goto command, but fortunately it can be removed from the input code and get an equivalent code, due to the sequence of Goto and Labels commands in reverse topological order always. In other words, the definitions come after their uses. Thus, Snowconvert just needs to copy bottom-up all Label section code to its corresponding Goto statements.
.LOGON 0/dbc,dbc;
DATABASE tduser;
.LOGON 127.0.0.1/dbc,dbc;
INSERT INTO TABLEB VALUES (1);
.IF activitycount = 0 then .GOTO SECTIONA
.IF activitycount >= 1 then .GOTO SECTIONB
.label SECTIONA
.REMARK 'Zero Hours on Account'
.GOTO SECTIONC
.label SECTIONB
.REMARK 'Total Hours on Account'
.label SECTIONC
.logoff
.exitRelated EWIS
MSCEWI2070: A return statement was added at the end of the label section to ensure the same execution flow.
MSCEWI2071: GOTO statement was replaced with the label section with the same name.
MSCEWI2072: LABEL not found, GOTO statement was replaced with return statement.
MSCEWI1002: Removed next statement, not applicable in SnowFlake.
Last updated
Was this helpful?