Example: Creating Functions that Algorithmically Compress LOB-Related Data - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

The CREATE FUNCTION requests in this example are written to algorithmically compress various kinds of LOB-related data.

See Teradata Vantage™ - SQL External Routine Programming , B035-1147 for information about how to write the C, C++, or Java code for the external functions these function definitions reference to compress LOB-related data.

You can find the functions written to decompress the data algorithmically compressed by the functions in these examples in Example: Creating Functions that Decompress Algorithmically Compressed LOB-Related Data.

This example creates a UDF named clob_compress to algorithmically compress CLOB columns.

     CREATE FUNCTION clob_compress (a CLOB AS LOCATOR) 
     RETURNS BLOB AS LOCATOR 
     SPECIFIC clob_compress 
     LANGUAGE C 
     NO SQL  
     FOR COMPRESS 
     PARAMETER STYLE TD_GENERAL 
     RETURNS NULL ON NULL INPUT 
     DETERMINISTIC 
     EXTERNAL NAME 'cs!clobcompress!clobcompress.c';

This example creates a UDF named d_clob_compress to algorithmically compress distinct LOB-based UDT columns.

     CREATE FUNCTION d_clob_compress (a DCLOB) 
     RETURNS BLOB AS LOCATOR 
     SPECIFIC d_clob_compress 
     LANGUAGE C 
     NO SQL  
     FOR COMPRESS 
     PARAMETER STYLE TD_GENERAL RETURNS NULL ON NULL INPUT 
     DETERMINISTIC 
     EXTERNAL NAME 'cs!dclobcompress!dclobcompress.c';