condition_statement - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

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.