17.10 - Example: Compression Using MVC and ALC - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)

In this example, assume that the default server character set is UNICODE. The NULLs in the Gem column are compressed. MVC is used to compress the values 'amethyst' and 'amber' in the Gem column. Because UPPERCASE is specified, all values of 'amethyst' and 'amber' are compressed regardless of case. The Teradata-supplied function, TransUnicodeToUTF8, compresses all non-null values in the Gem column that are not 'amethyst' or 'amber'. The TransUTF8ToUnicode function uncompresses the values compressed by TransUnicodeToUTF8.

CREATE TABLE Pendants
   (ItemNo INTEGER,
    Gem CHAR(10) UPPERCASE COMPRESS ('amethyst', 'amber')
        COMPRESS USING TD_SYSFNLIB.TransUnicodeToUTF8
        DECOMPRESS USING TD_SYSFNLIB.TransUTF8ToUnicode);