16.20 - Example: Viewing Results for UNKNOWN Conditions - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2020-03-25
dita:mapPath
xzf1512079057909.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
kby1472250656485

In this example, the session collation is ASCII.

CASE_N (a<'b', a>='ba' and a<'dogg' and b<>'cow', c<>'boy', UNKNOWN)

The following table shows the result value returned by the above CASE_N function given the specified values for a, b, and c. The x and yrepresent any value or NULL. The value 4 is returned if a condition is UNKNOWN with all preceding conditions evaluating to FALSE. NULL is returned if all the conditions are false.

a b c Result
'a' x y 1
'boy' 'girl' y 2
'boy' NULL y 4
'boy' 'cow' 'man' 3
'boy' 'cow' 'boy' NULL
'dog' 'ball' y 2
'dogg' x NULL 4
'dogg' x 'man' 3
'egg' NULL 'boy' NULL
'egg' x 'boy' NULL
'egg' x NULL 4
'egg' x 'girl' 3