Example 2 Using FNC_GetPhaseEx - 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ā„¢
By using the FNC_GetPhaseEx options, you can reduce the number of table phase transitions and improve table function performance in the following situations:
  • In a 1:1 (one row in : one row out) processing mode, use the TBL_NEWROW option to get a new row on every TBL_BUILD call.
    FNC_Mode mode = FNC_GetPhaseEx(&thePhase, TBL_NEWROW);
  • In a 1:M (one row in : many rows out) processing mode, use the TBL_NEWROWEOF option to get a new row when EOF is signaled.
    FNC_Mode mode = FNC_GetPhaseEx(&thePhase, TBL_NEWROWEOF);
  • In a M:1 (many rows in : one row out) processing mode, you can use:
    FNC_Mode mode = FNC_GetPhaseEx(&thePhase, TBL_LASTROW | TBL_NEWROW);

    In a combined M:1 and 1:M processing mode, you can use the following that does not pass a new row until EOF:

    FNC_Mode mode = FNC_GetPhaseEx(&thePhase, TBL_LASTROW | TBL_NEWROWEOF);