Error Conditions

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

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

The following conditions or expressions are considered illegal in a CASE expression:

Condition or Expression Example
A condition after the keyword CASE is supplied.
SELECT CASE a=1
        WHEN 1
        THEN 1
        ELSE 0
        END
FROM t;
A non valid WHEN expression is supplied in a valued CASE expression.
SELECT CASE a
        WHEN a=1
        THEN 1 
        ELSE 0 
       END 
FROM t;
A non valid WHEN condition is supplied in a searched CASE expression.
SELECT CASE 
        WHEN a
        THEN 1 
        ELSE 0 
       END 
FROM t;
SELECT CASE
        WHEN NULL
        THEN 'NULL'
       END
FROM table_1;
A non-scalar subquery is specified in a WHEN condition of a searched CASE expression.
SELECT CASE 
        WHEN t.a IN 
         (SELECT u.a 
          FROM u)
        THEN 1 
        ELSE 0 
       END 
FROM t;
A CASE expression references multiple UDTs that are not identical to each other.
SELECT CASE t.shape.gettype()
        WHEN 1 
        THEN NEW circle('18,18,324')
        WHEN 2
        THEN NEW square('20,20,400')
       END;