CASE Value Expression - Parallel Transporter

Teradata® Parallel Transporter User Guide - 17.20

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Parallel Transporter
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-08-25
dita:mapPath
uzp1645128359760.ditamap
dita:ditavalPath
tvt1507315030722.ditaval
dita:id
B035-2445
Product Category
Teradata Tools and Utilities

CASE value expressions allow derived column values in a target row to vary depending on which condition is satisfied by the corresponding source row. The CASE value expression has the same structure as the CASE DML expression, except that it associates a numeric value expression or string value expression with each condition rather than a DML group, as follows:

CASE  WHEN <condition 1> THEN <value expression 1>
      WHEN <condition 2> THEN <value expression 2>
        :        :         :            :
      WHEN <condition n> THEN <value expression n>
      ELSE <value expression n+1>
END

The value of a CASE value expression is the value of the expression corresponding to the first condition that is met, else the value of the ELSE’s expression, if present, else NULL. The value expressions must all evaluate to data values of the same basic type, either all numeric or all string.

CASE Value Expression Example

SELECT COL1
       CASE WHEN COL2 < 256    THEN COL4 * 16
            WHEN COL2 > 32767  THEN COL4 + COL5
                               ELSE COL6
       END AS COL2,
       COL3 FROM...