Example - 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™

The following is an example of using FNC_GetArrayElementCount to retrieve the number of present elements for a 1-D ARRAY:

void getNumAryElts ( ARRAY_HANDLE  *phone_ary,
                     INTEGER       *result,
                     char           sqlstate[6])
{
    int presElementsCount;
    int lastElement[1];

    /* Get the number of elements currently stored in the array. */
    FNC_GetArrayElementCount((*phone_ary), &presElementsCount,
       lastElement);
    *result = presElementsCount;
    ...
}

The following example calls FNC_GetArrayElementCount to retrieve the number of present elements for an n-D ARRAY:

void SeismicStations ( ARRAY_HANDLE  *seismic_ary,
                       INTEGER       *result,
                       char           sqlstate[6])
{
    int presElementsCount;
    int lastElement[FNC_ARRAYMAXDIMENSIONS];
    /* Get the number of readings(elements) of seismic_ary. */
    FNC_GetArrayElementCount((*seismic_ary), &presElementsCount,
       lastElement);
    ...
}