Passing LOB Data in the Intermediate Aggregate Storage Area - Teradata Vantage - Analytics Database

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
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ā„¢

A locator is valid only while running the UDF to which the locator is passed as an argument. Because of this limitation, a locator cannot be passed in the intermediate aggregate storage area that aggregate functions use to accumulate summary information.

Instead, an aggregate function must convert a locator to a persistent object reference, a reference that is valid while running the SQL request.

The sqltypes_td.h header file defines a persistent object reference as a LOB_REF type:

typedef struct LOB_REF{
    unsigned char data[50];
} LOB_REF;

A LOB_REF is invalid outside the request in which it is created. If you try to pass a LOB_REF out of the request (by storing it in a table, for example) and later attempt to convert it back to a locator, the function fails.

To convert a locator to or from a persistent object reference that can be passed in the intermediate aggregate storage area, Teradata provides the following library functions:
  • FNC_LobLoc2Ref
  • FNC_LobRef2Loc
Topic Reference
Detailed information on FNC_LobLoc2Ref and FNC_LobRef2Loc, including examples of how to use the functions C Library Functions
A complete example of an aggregate function using LOBs C Aggregate Function Using LOBs