17.10 - Example - 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)
#define SQL_TEXT Latin_Text
#include "sqltypes_td.h"

void strrev12(CHARACTER_LATIN *input,
              int              inplen,
              VARBYTE         *result)
{
   int i;
   for (i=0; i< inplen; i++)
      result->bytes[inplen-i-1] = input[i];
   result->length = inplen;
}

void strrevcomp_char(CHARACTER_LATIN *InputValue,
                     VARBYTE         *ResultValue,
                     char             sqlstate[6])
{
   int nullIndicator;
   int length;

   if (InputValue == NULL)
   {
      strcpy(sqlstate, "03288");
      return;
   }
   length = FNC_GetCharLength(InputValue);
   strrev12(InputValue, length, ResultValue);
   strcpy(sqlstate, "00000");
}