15.00 - Error Conditions - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)
Last Update
2018-09-24

Error Conditions

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;