Implicit Character Data Type Conversion - 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™

TRANSLATE performs implicit conversion if the string server character set does not match the type implied by source_repertoire_name.

An implicit conversion generates an error if a character from character_string_expression has no corresponding character in the source_repertoire_name type. This holds regardless of whether you specify the WITH ERROR option.

For example, the following function first translates the string from UNICODE to LATIN, because Vantage treats literals as UNICODE, and then translates the string from LATIN to KANJISJIS. However, the translation generates an error because the last character is not in the LATIN repertoire.

   ...
   TRANSLATE('abc ' USING LATIN_TO_KanjiSJIS WITH ERROR)   ...

To circumvent the problem if error character substitution is acceptable, specify two levels of translation, as used in the following example.

   ...
   TRANSLATE((TRANSLATE(_UNICODE 'abc' USING UNICODE_TO_LATIN WITH
ERROR)) USING LATIN_TO_KanjiSJIS WITH ERROR)

Examples

Function Result Type of the Result
TRANSLATE('abc' USING UNICODE_TO_LATIN) 'abc' VARCHAR(3)

CHARACTER SET LATIN

TRANSLATE('abc' USING UNICODE_TO_UNICODE_Fullwidth) 'abc ' VARCHAR(3)

CHARACTER SET UNICODE

TRANSLATE('abc ' USING UNICODE_TO_LATIN WITH ERROR)

where ε represents the designated error character for LATIN (0x1A).

'abcε ' VARCHAR(4)

CHARACTER SET LATIN