15.00 - TransUTF8ToUnicode - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)
Last Update
2018-09-24

TransUTF8ToUnicode

Purpose  

Uncompresses the Unicode data that was compressed using the TransUnicodeToUTF8 function.

Syntax  

where:

 

Syntax element…

Specifies…

TD_SYSFNLIB

the name of the database where the function is located.

compressed_string

Unicode character data that was compressed using the TransUnicodeToUTF8 function.

Note: This function takes no arguments when used as part of the COMPRESS USING or DECOMPRESS USING phrases. For more information about the COMPRESS/DECOMPRESS phrase, see SQL Data Types and Literals.

ANSI Compliance

This is a Teradata extension to the ANSI SQL:2011 standard.

Argument Type and Rules

Expressions passed to this function must have a data type of VARBYTE(n), where the maximum supported size (n) is 64000.

The input to this function must be the output result of the TransUnicodeToUTF8 function.

If you specify NULL as input, the function returns NULL.

Result Type

The result data type is VARCHAR(32000) CHARACTER SET UNICODE

Usage Notes

TransUTF8ToUnicode takes Unicode data that was compressed using the TransUnicodeToUTF8 function, uncompresses it, and returns an uncompressed Unicode character string as the result.

Although you can call the function directly, TransUTF8ToUnicode is normally used with algorithmic compression (ALC) to uncompress table columns previously compressed with TransUnicodeToUTF8.

For more information about ALC, see “COMPRESS and DECOMPRESS Phrases” in SQL Data Types and Literals.

Example

In this example, assume that the default server character set is UNICODE. The values of the Description column are compressed using the TransUnicodeToUTF8 function with ALC, which stores the Unicode input in UTF8 format. The TransUTF8ToUnicode function uncompresses the previously compressed values.

   CREATE TABLE Pendants
      (ItemNo INTEGER, 
       Gem CHAR(10) UPPERCASE,
       Description VARCHAR(1000)
          COMPRESS USING TD_SYSFNLIB.TransUnicodeToUTF8
          DECOMPRESS USING TD_SYSFNLIB.TransUTF8ToUnicode);