17.10 - Example: Viewing Results for FALSE Conditions - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL Functions, Expressions, and Predicates

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

In this example, the session collation is ASCII.

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

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

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