condition_statement - Analytics Database - Teradata Vantage

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
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.