Phases of a Variable Mode Table Function | Teradata Vantage - 17.10 - Phases of a Variable Mode Table Function - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

Vantage invokes a variable mode table function repeatedly, allowing the function to pass through different phases where it initializes itself, connects to external objects, builds output rows, closes open connections, and cleans up. The function can use the FNC_GetPhase or the FNC_GetPhaseEx library function to determine which phase it is in and what action to take.

A function that uses the FNC_GetPhase library function passes through the following phases.


FNC_GetPhase library function phases

Alternatively, a table function that needs to know when it is passed in the last qualified row on an AMP (perhaps because the function does not return a row until it has processed all of the input rows) can use the FNC_GetPhaseEx function with the TBL_LASTROW option and pass through the following phases.


FNC_GetPhaseEx library function phases

For more information on implementing each phase of a variable mode table function, see Implementation Guidelines.