Concatenating Character Strings Having Different Server Character Sets - 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™

There are special considerations for the concatenation of character strings that specify different server character sets in the CHARACTER SET attribute.

Implicit translation rules apply.

If the strings are fixed strings, then the result is varying with length equal to the sum of the lengths of the strings being concatenated.

This is true regardless of whether the string lengths are defined in terms of bytes or characters. So, a fixed n -byte KANJISJIS character string concatenated with a fixed m -character UNICODE string produces a VARCHAR(m+n) CHARACTER SET UNICODE result.

Consider the following table definition:

   CREATE TABLE tab1 
      (cunicode  CHARACTER(4)  CHARACTER SET UNICODE
      ,clatin    CHARACTER(3)  CHARACTER SET LATIN 
      ,csjis     CHARACTER(3)  CHARACTER SET KANJISJIS);

The following values are inserted into table tab1:

   INSERT tab1 ('abc', 'abc', 'abc');

The following table illustrates these concatenation properties.

Concatenation Result Type of Result
cunicode || clatin 'abcΔ abc' VARCHAR(7) CHARACTER SET UNICODE
clatin || csjis 'abcabc' VARCHAR(6) CHARACTER SET UNICODE
cunicode || csjis 'abcΔ abc' VARCHAR(7) CHARACTER SET UNICODE

With the exception of KanjiEBCDIC, concatenation of KANJI1 character strings acts as described earlier. Under KanjiEBCDIC, any adjacent shift-out (<) and shift-in (>) characters within the resulting expression are removed. The result string is padded as necessary with trailing <single-byte space> characters.