Example: Set the Value of the Element in Position 2 of the Array - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

In this example, FNC_SetArrayElements is called to set the element in position 2 to the value of the newVal argument.

/* This function sets one single element value. */
void setOneElement ( ARRAY_HANDLE    *phone_ary,
                     CHARACTER_LATIN  newVal[10],
                     INTEGER         *result,
                     char             sqlstate[6])
{
    int nullIndicator;
    bounds_t arrayRange;
    nullIndicator = 0;
    arrayRange.lowerBound = 2;
    arrayRange.upperBound = 2;
    /* Set the element in position 2 to the value of newVal. */
    FNC_SetArrayElements(*phone_ary, &arrayRange, (void*)newVal,
       nullIndicator, SIZEOF_CHARACTER_LATIN_WITH_NULL(10));
    ...
}