tdr.LobOpen_CL Function | R Table Operators | Teradata Vantage - tdr.LobOpen_CL - 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 a LOB for reading. Returns a list to use to read the LOB. The list has two elements, contextID and LOBlen.

Syntax

tdr.LobOpen_CL(locator,  start,  maxlength)

Syntax Elements

locator
Parameter type: integer

The locator of the LOB stored in the table.

start
Parameter type: numeric

Start reading at this position in the LOB.

maxlength
Parameter type: numeric

The maximum number of bytes to read.

Usage Notes

This function is valid only if called from the table operator.

An error is raised if the function is called from the contract function.

Example: Open a LOB for Reading

Consider an input table with 5 attributes: (int, int, int, int, clob). This example shows how to read the last attribute of the current row as follows:
  • Get the LOB locator
  • Open the LOB
  • Read the LOB
  • Close the LOB
# Open the input stream
inHandle <- tdr.Open("R", 0, 0);

# Get the 5th attribute in the current row (LOB locator)
att5 <- tdr.GetAttributeByNdx(inHandle, 4, NULL);

# Open the LOB for reading
inlob <- tdr.LobOpen_CL(att5,0,0);

# Read the LOB, convert it to character, and print it
string <- tdr.LobRead(inlob$contextID, inlob$LOBlen);
print(rawToChar(string$buffer));

# Close the LOB
tdr.LobClose(inlob$contextID);