16.20 - tdr.LobAppend - 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

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

Syntax

tdr.LobAppend(  locator,  data)
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.

Return Value

A status code.

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)