Examples of Character and Numeric Data in a CASE Expression: Example 2 - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantageā„¢

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;