tdr.GetColDef Function | R Table Operators | Teradata Vantage - tdr.GetColDef - 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ā„¢
Returns a list with the schema of the specified stream, including the definition of each column, which includes the following information:
  • Name
  • 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

Syntax

tdr.GetColDef(  streamno,  direction  )

Syntax Elements

streamno
Parameter type: integer

The stream number.

direction
Parameter type: character
Valid values are as follows:
  • "R" (input)
  • "W" (output)

Example: Get the Column Definitions of an Input Stream

stream <- 0;
direction <- "R";
incols <- tdr.GetColDef(stream, direction);
print(incols);

The list incols contains the following for a stream with three attributes (COL1 int, COL2 real, COL3 varchar(30)):

$COL1
$COL1$datatype
[1] 9

$COL1$bytesize
[1] 4

$COL2
$COL2$datatype
[1] 10

$COL2$bytesize
[1] 8

$COL3
$COL3$datatype
[1] 2

$COL3$charset
[1] 1

$COL3$size.length
[1] 30
You can get the number of columns in the stream by calling the length function:
length(incols)