16.20 - FNC_TblOpRead - 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)

Purpose

Allows table operator writers to read rows from an input stream. The function sets the read context to the next input row of data.

Syntax

int
FNC_TblOpRead(FNC_TblOpHandle_t *handle)
FNC_TblOpHandle_t *handle
a handle associated with an input stream. This should be the handle returned by FNC_TblOpOpen.

For details about the FNC_TblOpHandle_t structure, see Table Operator Data Structures.

Return Value

An integer that indicates TBLOP_SUCCESS, TBLOP_EOF (no more data), TBLOP_ABORT, or TBLOP_ERROR.

Usage Notes

You can read all or a subset of the input rows. For more efficient access, the data can be directly accessed through the handle structure.

You must call FNC_TblOpOpen first, then pass the handle returned from FNC_TblOpOpen as an argument to FNC_TblOpRead. If you call FNC_TblOpOpen with the options field set to TBLOP_NOOPTIONS, the read call prepares the field access allowing direct access to individual attributes via FNC_TblOpGetAttributeByNdx or directly via handle->row->indicators, columnptr[index] and lengths[index].

If the options field is set to TBLOP_RAWMODE, the raw row can be accessed as follows:
Access handle->row to access the current raw row length, 
IndicData format, record body)

TBLOP_EOF is returned if you read past the End of File. If you specify the PARTITION BY clause, End of File occurs after the last row in the partition is read.

Example Using FNC_TblOpRead

See C Table Operator for an example of how to use this function.

Related Topics

For information about the current_row_t structure which stores information about the current row, see Table Operator Data Structures.