Example

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
Function Result
TRANSLATE_CHK(‘abc’ USING UNICODE_TO_LATIN) 0
TRANSLATE_CHK(‘abc ’ USING UNICODE_TO_LATIN) 4

Consider the following table definition:

   CREATE TABLE table_1
     (cunicode CHARACTER(64) CHARACTER SET UNICODE);

To find all values in cunicode that can be translated to LATIN, use the following statement:

   SELECT cunicode
   FROM table_1
   WHERE TRANSLATE_CHK(cunicode USING Unicode_TO_Latin) = 0;

Consider the following table definitions:

   CREATE TABLE table_1
     (ckanji1 VARCHAR(20) CHARACTER SET KANJI1);
   
   CREATE TABLE table_2
    (cunicode CHARACTER(20) CHARACTER SET UNICODE);

Assume table_1 is populated from the KanjiEUC client character set.

To translate the data in ckanji1 in table_1 to UNICODE, and populate table_2 with translations that have no errors, use the following statement:

   INSERT INTO table_2
   SELECT TRANSLATE(ckanji1 USING Kanji1_KanjiEUC_TO_Unicode)
   FROM table_1
   WHERE TRANSLATE_CHK(ckanji1 USING Kanji_KanjiEUC_TO_Unicode) = 0;

After converting column ckanji1 in table_1 to column cunicode in table_2, you want to find all the fields in table_1 that could not be translated.

   SELECT ckanji1
   FROM table_1
   WHERE TRANSLATE_CHK(ckanji1 USING Kanji1_KanjiEUC_TO_Unicode) <> 0;