tdr.LobAppend Function | R Table Operators | Teradata Vantage - 17.10 - tdr.LobAppend - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

Appends raw data to the end of the output LOB associated with a specified output locator. Returns a status code.

Syntax

tdr.LobAppend(  locator,  data)

Syntax Elements

locator
Parameter type: integer

The output locator returned by the tdr.LobCol2Loc function.

data
Parameter type: raw

A vector with raw data to be appended to the output LOB.

Usage Notes

Before you call this function, you must call the tdr.LobCol2Loc function to get the output locator for the LOB where the data will be appended.

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: Store an R Data Structure as a LOB in a Table

This example shows how an R data structure can be stored as a LOB in a table with two attributes: (int, blob):

  1. Call the glm R function to compute a model and return an R data structure.
  2. Serialize the data structure.
  3. Store the data structure in the second column of the current output row.
    lin_model <- glm(cc_rev ~ income + age + avg_ck_bal + avg_sv_bal, data = training)
    slin_model <- serialize( lin_model, NULL )
    loc <- tdr.LobCol2Loc(0,1)
    return_value <- tdr.LobAppend (loc, slin_model)