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

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

The functions in these examples are designed to decompress LOB-based data that has been algorithmically compressed by the examples in “Example: Creating Functions that Algorithmically Compress 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 decompress LOB-related data.

This example creates a UDF named clob_decompress to decompress CLOB columns that were algorithmically compressed using the function clob_compress from Example: Creating Functions that Algorithmically Compress LOB-Related Data.

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

This example creates a UDF named d_clob_decompress to decompress distinct LOB-based UDT columns that were algorithmically compressed using the function d_clob_compress from Example: Creating Functions that Algorithmically Compress LOB-Related Data.

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

This example creates a UDF named s_clob_decompress to decompress distinct LOB-based UDT columns that were algorithmically compressed using the function s_clob_compress from Example: Creating Functions that Algorithmically Compress LOB-Related Data.

     CREATE FUNCTION s_clob_decompress (a BLOB AS LOCATOR) 
     RETURNS SCLOB 
     SPECIFIC s_clob_decompress 
     LANGUAGE C 
     NO SQL  
     FOR DECOMPRESS 
     PARAMETER STYLE TD_GENERAL RETURNS NULL ON NULL INPUT 
     DETERMINISTIC 
     EXTERNAL NAME 'cs!sclobdecompress!sclobdecompress.c';