16.20 - Allocating the newValues Buffer - 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)

To define the buffer pointed to by newValues, use the C data type that maps to the underlying type of the element. Be sure to allocate the buffer for the number of elements that you are modifying. 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 newValues character string is shorter than the size defined for the type, FNC_SetArrayElementsWithMultiValues 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 newValuesBufSize argument.

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

Be sure to release allocated resources after you process the data.