FNC_TblOpOpen Function | C Library Functions | Teradata Vantage - FNC_TblOpOpen - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

Purpose

Allows table operator writers to open an input or output stream.

Syntax

FNC_TblOpHandle_t *
FNC_TblOpOpen(int           streamno,
              char          mode,
              unsigned int  options);
int streamno
the stream number.
char mode
the mode of the stream : 'R' or 'W'.
unsigned int options
whether individual attributes can be accessed or modified. Valid values are:
  • TBLOP_NOOPTIONS - Indicates that the attributes can be accessed or modified individually via two options:
    • Using FNC_TblOpGetAttributeByNdx or FNC_TblOpBindAttributeByNdx.
    • Directly setting indicators, column pointers and lengths of the row in the handle.
  • TBLOP_RAWMODE - Indicates that the access mode will be raw row. The raw row length and the body of the raw row can be accessed and set. For details, see FNC_TblOpRead and FNC_TblOpWrite.

    LOB columns are not supported when TBLOP_RAWMODE is selected for options in either of the input or output streams.

Return Value

A pointer to an FNC_TblOpHandle_t structure or NULL if an error occurred.

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

Usage Notes

You can use this function to open an input stream multiple times within a table operator invocation. The function initializes the specified stream number streamno iterator interface for reading or writing, based on the mode value. Each open resets the read position to the start of the stream. You can decide to never open the input stream or to open without reading the input stream.

You can open an output stream a single time within a table operator invocation. You can decide to never open the output stream or open without writing the output stream.

If you specify the PARTITION BY clause, then opening a stream refers to the rows within the partition. For example, End of File occurs after the last row in the partition is read. If you do not specify the PARTITION BY clause, opening a stream refers to the rows within the AMP.

The following are not allowed and result in an error:
  • Open an input or output stream that is already open.
  • Close and reopen an output stream.

Example Using FNC_TblOpOpen

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