16.20 - C Function Definition - 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)
/*****  C source file name: to_inches.c  *****/

#define  SQL_TEXT Latin_Text
#include <sqltypes_td.h>
#include <string.h>

void meter_toInches( UDT_HANDLE  *meterUdt,
                     FLOAT       *result,
                     char         sqlstate[6])
{
   FLOAT value;
   int length;

   /* Get meter's value. */
   FNC_GetDistinctValue(*meterUdt, &value, SIZEOF_FLOAT, &length);

   /* Convert meters to inches and set the result value. */
   *result = value * 3.28 * 12;
}