SnowConvert AI - Teradata - COMMON STATEMENTS¶
Translation references to convert Teradata script statements that are in common among all scripts syntaxes to Snowflake SQL
ERROR HANDLING¶
The BTEQ error handling capabilities are based on the Teradata Database error codes. These are the standard error codes and messages produced in response to user-specified Teradata SQL statements. A BTEQ user cannot change, modify or delete these messages.
For more information, see the Teradata BTEQ Error Handling documentation.
Sample Source Patterns¶
Basic BTEQ Error Handling Example¶
The error conditions content is relocated in different statements in case ERRORCODE is different to zero, otherwise it can be located as the original code. First, the query above the if statement is relocated within a BEGIN - END block, where in case of an exception it will be caught in the EXCEPTION block. Additionally, the ERRORCODE variable will be changed to the variable declared indicating its SQLCODE with an EWI indicating that the exact number of the SQLCODE is not the same as the ERRORCODE in BTEQ.
Teradata BTEQ¶
Snowflake SQL¶
Known Issues¶
No issues were found.
EXIT or QUIT¶
Logs off all database sessions and then exits BTEQ.
The highest severity value encountered during BTEQ’s execution will by default be used as BTEQ’s return code value unless an argument is explicitly supplied. (Teradata Basic Query Reference EXIT or QUIT Command)
Sample Source Patterns¶
Basic IF example¶
Teradata BTEQ¶
Snowflake SQL¶
Known Issues¶
When the EXIT or QUIT command doesn’t have an input, it returns the ERRORLEVEL as default. However, SnowConvert AI transforms it to return 0.
Related EWIs¶
SSC-FDM-TD0013: The Snowflake error code mismatches the original Teradata error code.
GOTO¶
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)
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 always in reverse topological order. In other words, the definitions come after their uses. Thus, SnowConvert AI just needs to copy bottom-up all Label section code to its corresponding Goto statements.
Teradata BTEQ¶
Snowflake¶
Known Issues ¶
No issues were found.
Related EWIs¶
SSC-EWI-0001: Unrecognized token on the line of the source code.
SSC-FDM-0027: Removed next statement, not applicable in Snowflake.
SSC-EWI-0073: Pending Functional Equivalence Review
SSC-FDM-TD0026: GOTO statement was removed due to if statement inversion.
IF… THEN…¶
Description¶
The IF statement validates a condition and executes an action when the action is true. (Teradata SQL Language reference IF…THEN…)
Sample Source Patterns¶
Basic IF example¶
Teradata BTEQ¶
Snowflake SQL¶
Related EWIs¶
No related EWIs.