Example Using FNC_LobAppend - 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™
#define SQL_TEXT Latin_Text
#include <sqltypes_td.h>
#define BUFFER_SIZE 100000

void concat2( LOB_LOCATOR *a,
              LOB_LOCATOR *b,
              LOB_RESULT_LOCATOR *result,
              char sqlstate[6] )
{
   FNC_LobLength_t actlen;
   BYTE            buffer[BUFFER_SIZE];
   LOB_CONTEXT_ID  id;
   int             trunc_err = 0;

   /* Append the first argument. */

   FNC_LobOpen(*a, &id, 0, 0);

   while( FNC_LobRead(id, buffer, BUFFER_SIZE, &actlen) == 0
          && !trunc_err )
  trunc_err = FNC_LobAppend(*result, buffer, actlen, &actlen); 

   FNC_LobClose(id);

   ...

}