Usage Notes - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantageā„¢

If this function is not called by a table operator with parameter style SQLTABLE, FNC_TblOpGetColDef sets an error.

Before calling FNC_TblOpGetColDef, you should invoke the following function and macro to allocate space for the buffer where the column definitions will be returned. Get the column count once and save it for use multiple times to avoid unnecessary FNC call overhead.

FNC_TblOpColumnDef_t *coldef;

int ColCount = FNC_TblOpGetColCount(0, 'R');
coldef = FNC_malloc(TblOpSIZECOLDEF(ColCount));

Function FNC_TblOpGetColCount retrieves the number of columns in an input stream and TblOpSIZECOLDEF computes the required size in bytes to store the column definitions of the input stream.

After memory is allocated, use the following macro to initialize the data structure:

TblOpINITCOLDEF(coldef, ColCount);

After initialization, function FNC_TblOpGetColDef can be called:

FNC_TblOpGetColDef(0, 'R', coldef);

Once the table operator is done with the column definitions in coldef, you need to release the memory:

FNC_free(coldef);