17.10 - condition_statement - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

Either a CASE statement or an IF statement.

See Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148 for details.

You can specify these options for condition statements.

CASE
Keyword introducing the CASE conditional statement to qualify control statements.
You can use either the Simple Case statement form or the Searched Case statement.
operand_2
Value expressions or arithmetic and string expressions.
SQL procedure local variables, status variables, IN or INOUT parameters, and FOR loop column and correlation names can be specified in the value expression.
THEN
ELSE
Keywords introducing the statements to be performed in the CASE statement.
statement
A valid SQL statement or SQL control statement.
conditional_expression
A boolean search condition used to evaluate whether a statement or statements embedded within an IF, CASE, REPEAT, or WHILE clause should be performed.
Arithmetic expressions, logical expressions, UDT expressions, and status variables can all be specified as conditional expressions.
You cannot use IN and NOT IN operators if the conditional list contains any local variables, parameters, or cursor correlation names.
OUT parameters and subqueries are not allowed in conditional_expression.
END CASE
Keywords marking the end of a CASE statement.
IF
Keyword introducing a conditional expression to qualify SQL control statements.
You can also use these variations of IF with the following additional clauses:
  • IF-THEN-END IF
  • IF-THEN-ELSE-END IF
  • IF-THEN-ELSEIF-END IF
  • IF-THEN-ELSEIF-ELSE-END IF
ELSE
ELSEIF
A keyword introducing the THEN, ELSE, or ELSEIF clause in an IF statement.
END IF
Keywords marking the end of the IF statement.