C Aggregate Function Using LOBs | UFC Code Examples | Teradata Vantage - C Aggregate Function Using LOBs - 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
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

This example implements the MAX_BLOB aggregate function and illustrates the use of persistent object references (LOB_REF).

Like the standard MAX aggregate function, it returns the greatest BLOB value of the given set. The comparison rule is the same as for VARBYTE or BYTE type values; that is, trailing zeros are not significant.

The algorithm assumes that the objects to be compared are random-valued byte strings. A complete ordering of a pair of strings can be determined by examining the first unequal byte pair.

In the vast majority of cases, the first unequal byte pair can be found within the first PREFIX_SIZE (500) bytes. By saving the prefix of the winner of each comparison, the need to reread any object is rare.