16.20 - Table UDFs that Retain Data Between Iterations - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
April 2020
Content Type
Programming Reference
Publication ID
English (United States)

Table UDFs can use intermediate storage to retain data between iterations.

In the TBL_PRE_INIT phase, a table function usually allocates intermediate storage space by calling com.teradata.fnc.Tbl.allocCtx(), passing in an initialized instance of the class that the table function uses to hold the data it wants to retain. In later phases, the table function calls com.teradata.fnc.Tbl.setCtxObject() to write data to the previously allocated intermediate storage space and com.teradata.fnc.Tbl.getCtxObject() to retrieve the data and continue the processing.