16.20 - Example Using FNC_GetQueryBandValue - 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)
#define SQL_TEXT Latin_Text
#include<sqltypes_td.h>

void getJobTitle( VARCHAR_LATIN *jobTitle, char sqlstate[6])
{

   char *QBBuf;
   int QBLen;

   QBBuf = FNC_malloc(FNC_MAXQUERYBANDSIZE);
   if (QBBuf == NULL)
   {
      strcpy(sqlstate, "U0004");
      strcpy((char *) error_message, "malloc failed");
   }
   else
   {
      FNC_GetQueryBand(QBBuf, FNC_MAXQUERYBANDSIZE, &QBLen);
      if (QBLen > 0)
      {
         FNC_GetQueryBandValue(QBBuf, QB_FIRST, "JOBTITLE", jobTitle); 
      }
      strcpy(sqlstate, "00000");
      FNC_free(QBBuf);
   }
   return;
}