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

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

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

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