16.20 - Options - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

The following options are valid only for variable mode table functions. These options are ignored if you specify them in a constant mode table function.

Options Value Description and Usage
TBL_NOOPTIONS 0 Indicates that no options are specified.

Use this option when you only want to retrieve the processing phase in which the function was called.

TBL_LASTROW 1 Allows a function to determine when it is being passed the last input row on an AMP.

Use this option if your table function processes a set of input rows before returning an output row. You must set the EOF indicator when using TBL_LASTROW to signal the end of the processing when the last row has been encountered. The function then moves from the TBL_BUILD phase to the TBL_BUILD_EOF phase where the row is built.

TBL_NEWROW 2 If this option is set and the phase is TBL_BUILD, the function is called with a new row with a phase of TBL_BUILD.

Use this option when you want to get a new row on each function invocation.

If end of file, TBL_LASTROW or ProcessLastRow is true, then this option is ignored.

TBL_NEWROW and TBL_LASTROW 3 The behavior for both the TBL_NEWROW and TBL_LASTROW options are in effect.
TBL_NEWROWEOF 4 If this option is set, and the phase is TBL_BUILD and EOF is set, then the function is called with a new row with a phase of TBL_BUILD.

Use this option when you want to get a new row when EOF is signaled.

If end of file, TBL_LASTROW or ProcessLastRow is true, then this option is ignored.

TBL_NEWROWEOF and TBL_LASTROW 5 The behavior for both the TBL_NEWROWEOF and TBL_LASTROW options are in effect.

If you specify TBL_LASTROW, the option remains in effect for the duration of the request. The TBL_NEWROW and TBL_NEWROWEOF options are set and reset based on the options specified during each call to FNC_GetPhaseEx where the option value is nonzero.

For example, calling FNC_GetPhaseEx with the option TBL_NOOPTIONS does not reset the TBL_NEWROW or TBL_NEWROWEOF behavior.