Using Conditional Logic in a Query
The following conditional logic commands can be used within queries.
Table Legend
= |
> |
< |
>= |
<= |
<> |
!= |
^= |
~= |
|
Command |
Description |
.IF {ACTIVITYCOUNT} oper n [THEN] {.GOTO label} {ERRORCODE } {.EXIT [n] } |
If the condition is true, the action is performed. Otherwise the flow continues to the following statement. This command cannot be used before the first SQL statement. |
.GOTO label |
The next statement executed is the statement following the .LABEL command. |
.LABEL label |
Defines the destination of a .GOTO command. |
[ n ] .EXIT [ ERRORCODE ] [ ACTIVITYCO[UNT]] |
Execution terminates at this command. The optional parameter is used as the result code for the query. Zero indicates a successful query, any other value indicates failure. |
.QUIT |
Performs the same function as the .EXIT command. |
.SET value |
This command is for BTEQ compatibility only. This command is ignore. Unlike BTEQ, The .SET prefix is required for Teradata SQL Assistant to recognize and ignore a command. |
.RUN filename |
Execute the query contained in the specified filename. The RUN command must be the first and only statement executed. |