Return Value - 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™

FNC_TblGetColDef returns a pointer to an FNC_ColumnDef_t structure that contains all the result column definitions.

If the table function that calls FNC_TblGetColDef is not a table function with dynamic result row specification, FNC_TblGetColDef returns a NULL pointer.

FNC_ColumnDef_t is defined as:

typedef struct
{
   int    num_columns;
   parm_t column_types[1];
} FNC_ColumnDef_t;
Member ... Specifies ...
num_columns the number of entries in the column_types array, which is the same as the number of result columns for the table function execution.
column_types a parm_t array that provides the data type and attributes of each result column.

The parm_t structure is defined in sqltypes_td.h as:

typedef struct parm_t
{
  dtype_et    datatype;
  dmode_et    direction;
  charset_et  charset;
  union {
    long  length;
    int   intervalrange;
    int   precision;
    struct {
      int  totaldigit;
      int  fracdigit;
    } range;
  } size;
} parm_t;
where:
  • datatype specifies the data type of the column. The sqltypes_td.h header file defines dtype_et as:
    typedef int dtype_et;
  • Valid values are defined by the dtype_en enumeration in sqltypes_td.h. For a list of the valid values, see the dtype[] argument in FNC_CallSP.

  • charset specifies the character set of CHAR or VARCHAR data.

    The sqltypes_td.h header file defines charset_et as:

    typedef int charset_et;

    Valid values are defined by the charset_en enumeration in sqltypes_td.h:

    typedef enum charset_en
    {
       UNDEF_CT=0,
       LATIN_CT=1,
       UNICODE_CT=2,
       KANJISJIS_CT=3,
       KANJI1_CT=4
    } charset_en;
  • size.length specifies the length of a CHAR, VARCHAR, or BYTE type.
  • size.intervalrange specifies the range of an INTERVAL type. For example, 4 for INTERVAL YEAR(4).
  • size.precision specifies the precision in a TIME or TIMESTAMP type. For example, 4 for TIME(4).
  • size.range.totaldigit specifies the value m in a DECIMAL(m,n) or INTERVAL SECOND (m,n) type.
  • size.range.fracdigit specifies the value n in a DECIMAL(m,n) or INTERVAL SECOND (m,n) type.
The direction member of the parm_t structure does not provide information about result column definitions. For details on the direction member of the parm_t structure, see FNC_CallSP.