Examples of Character and Numeric Data in a CASE Expression: Example 2

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

For this example, assume the following table definition:

   CREATE table_1
     (i        INTEGER,
      column_l CHARACTER(10) CHARACTER SET LATIN,
      column_u CHARACTER(10) CHARACTER SET UNICODE,
      column_j CHARACTER(10) CHARACTER SET KANJISJIS,
      column_g CHARACTER(10) CHARACTER SET GRAPHIC,
      column_k CHARACTER(10) CHARACTER SET KANJI1);

The following query fails because the server character set is GRAPHIC (because the server character set of the first THEN with a character type is GRAPHIC):

   SELECT i, CASE
               WHEN i=1 THEN 4
               WHEN i=2 THEN column_g
               WHEN i=3 THEN 5
               WHEN i=4 THEN column_l
               WHEN i=5 THEN column_k
               ELSE 10
             END
   FROM table_1
   ORDER BY 1;