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

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
tpf1598412463935.ditamap
dita:ditavalPath
tpf1598412463935.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

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