16.20 - Example: Uncompressing Data Compressed with TransUnicodeToUTF8 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Operators and User-Defined Functions

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Administration
Programming Reference
Publication ID
B035-1210-162K
Language
English (United States)

To uncompress Unicode data that was compressed using TransUnicodeToUTF8, use the TransUTF8ToUnicode function.

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);