Example: Aggregate Function with Parameter Style TD_GENERAL - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

This aggregate function declaration uses parameter style TD_GENERAL:

/*****  C source file name: STD_DEV.c  *****/
   
#define SQL_TEXT Latin_Text
#include <sqltypes_td.h>
#include <string.h>
#include <math.h>
void STD_DEV ( FNC_Phase     phase,
               FNC_Context_t *fctx,
               FLOAT         *x,
               FLOAT         *result,
               char          sqlstate[6] )
{
     ...
}

The corresponding CREATE FUNCTION statement looks like this:

CREATE FUNCTION STD_DEV(x FLOAT)
RETURNS FLOAT
CLASS AGGREGATE
LANGUAGE C
NO SQL
PARAMETER STYLE TD_GENERAL
EXTERNAL;