CREATE FUNCTION and Algorithmic Compression of UDT Columns
You must specify either FOR COMPRESS or FOR DECOMPRESS, respectively, when you create an SQL function definition for an external UDF that is to be used to either compress or decompress BYTE, VARBYTE, CHARACTER, VARCHAR, GRAPHIC, Period, distinct UDT (including ARRAY/VARRAY), BLOB, CLOB, XML, Geospatial, distinct BLOB‑based UDT, distinct CLOB‑based UDT, or distinct XML‑based UDT column values algorithmically. If you do not specify these options in the function definition, it cannot be used to algorithmically compress or decompress column values.
The following rules apply to creating UDFs to implement algorithmic compression and decompression of UDT data.
Embedded services UDFs that are used for algorithmic compression are for Internal UDT types such as Period, ARRAY, VARRAY, and Geospatial. They cannot be used for structured UDTs.
External UDFs are mainly used for distinct UDTs.
Structured UDT types are supported for algorithmic compression.
Accessing or writing an algorithmically‑compressed column implicitly encapsulates the column reference with the appropriate routine.
See “Compressing Column Values Using Only Multi-Value Compression” on page 548 for additional information about the TD_LZ_COMPRESS and TD_LZ_DECOMPRESS UDFs.