The fetch_into Method

Use the fetch_into API when the consumer owns the memory for the data transfer area and requests that the producer use this area.

The fetch_into method is useful when the producer does not know how data should be arranged in memory. This method is used as an entry point when the consumer has a transfer area with a specific format. The fetch_into() function writes the fetched rows into the provided row block. This method is part of the a_v4_extfn_table_context structure.

The API uses a data transfer area that is defined by the structure a_v4_extfn_row_block, which is defined as a set of rows, where each row is defined as a set of columns. The creator of the row block can allocate enough storage to hold a single row or a set of rows. The producer can fill the rows, but cannot exceed the maximum number of rows allocated for the row block. If the producer has additional rows, the producer informs the consumer by returning the numeric value 1 from the fetch method.

This API enables consumers to optionally construct the row block, such that the data pointers refer to its own data structures. This allows the producer to directly populate memory within the consumer. A consumer may not want to do this, if data cleansing or validation checks are required first.

Fetch is executed against a table object, which is either the object produced as the result set of a table UDF or the object consumed as a result set of an input table parameter.

Related concepts
Using a Row Block to Produce Data
Related reference
fetch_into