16.20 - tdr.SetOutputColDef - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

Purpose

Sets the schema of the output stream.

Syntax

tdr.SetOutputColDef(  streamno,  coldef  )
streamno
Parameter type: integer

The output stream number.

coldef
Parameter type: list
The schema of a stream. This schema is a list with the number of columns and the definition of each column. Each definition includes the following column information:
  • Type

    Valid data type values are defined by the dtype_en enumeration in the sqltypes_td.h header file.

  • Size (in bytes)
  • Character type for textual fields:
    • 1 for LATIN
    • 2 for UNICODE

Usage Notes

This function is valid only if called from the contract function.

An error is raised if the function is called from the table operator.

Example: Set the Column Definitions of an Output Stream

This example sets the column definitions of an output stream with three attributes (COL1 int, COL2 real, COL3 varchar(30)).

stream <- 0;
integer = list( datatype="INTEGER_DT", bytesize=4 );
real <- list( datatype="REAL_DT", bytesize=8 );
varchar30 <- list(datatype="VARCHAR_DT", charset="LATIN_CT", size.length=30);
coldef <- list(COL1=integer, COL2=real, COL3=varchar30);
tdr.SetOutputColDef(stream, coldef);