16.20 - Usage Notes - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
April 2020
Content Type
Programming Reference
Publication ID
English (United States)

FNC_SetArrayElements takes aryHandle, arrayInterval, newValue, nullIndicator, and length as input arguments and sets the value of the specified elements to NULL or to the value pointed to by newValue.

To define the buffer pointed to by newValue, use the C data type that maps to the underlying type of the element. For example, if the ARRAY type is defined with an element type of SQL INTEGER, you can define the buffer like this:

INTEGER value;
value = 2048;

If the underlying type of the element is a character string, and the newValue character string is shorter than the size defined for the type, FNC_SetArrayElements fills to the right with spaces.

Because character data types allow embedded null characters, do not include null termination characters in the value you pass in for the lengthargument.

To guarantee that the value you pass in for the length argument matches the length of the data type in Teradata Database, use the data type length macros defined in the sqltypes_td.h header file. For a list of the data type length macros, see FNC_SetStructuredAttribute.

Be sure to release allocated resources once you have processed the data.

For more information, see Setting the Value of Array Elements.