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