tdr.Open Function | R Table Operators | Teradata Vantage - tdr.Open - 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ā„¢

Opens an input or output stream. Returns a handle of type raw to the iterator associated with the stream. You can use the handle to read or write rows and to close the iterator.

If an error occurs, the function returns NULL.

Syntax

tdr.Open(  direction,  streamno,  options  )

Syntax Elements

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

The stream number.

options
Parameter type: integer
How the stream is manipulated.
The only valid value for options is 0, which indicates that individual attributes can be accessed or modified.

Usage Notes

The function opens an input or output stream. Once the stream is opened, rows can be read or written.

You can open an input stream multiple times within a table operator invocation. Each open resets the read position to the start of the stream. If you specify the PARTITION BY clause, opening a stream refers to the rows within a partition. If you do not specify a PARTITION BY clause, opening a stream refers to the rows within the AMP.

You can open an output stream a single time within a table operator invocation.

This function is valid only if called from the table operator.
The following are not allowed and result in an error:
  • Open an input or output stream that is already open.
  • Close and reopen an output stream.
  • Call this function from the contract function.

Example: Opening an Input Stream

# Open the input stream.
library(tdr);
stream <- 0;
options <- 0;
direction <- "R";
inHandle <- tdr.Open(direction, stream, options);