Decompressing BLOB and CLOB Types - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-03-30
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
qnu1472247494689
lifecycle
latest
Product Category
Teradata Vantageā„¢

For information on UDFs with LOB input and return parameters, see Defining Functions that Use LOB Types.

When writing a scalar UDF that decompresses BLOB or CLOB types, use the following general structure:
  1. Define a buffer size (no larger than 64KB) for reading portions of the source LOB.
  2. Use FNC_LobOpen to open reading of the source LOB.
  3. While more data exists in the LOB:
    1. Use FNC_LobRead to read a portion of the LOB into the allocated buffer.
    2. Perform the decompression on the data in the buffer.
    3. Append the uncompressed contents of the buffer to the output LOB using FNC_LobAppend.
  4. Use FNC_LobClose to close reading of the source LOB.
  5. Handle errors reported by any FNC routines during processing.
  6. Release allocated resources once you have processed the data.

For information about the FNC functions, see LOB Access.

To see sample code for decompressing CLOB data, see C Scalar Function for Decompressing CLOB Data.