Usage Notes - 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ā„¢

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);