Example: Compression Using MVC and ALC

Teradata Vantageā„¢ Data Types and Literals

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

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