Allocating the newValues Buffer - 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ā„¢

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, 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.