16.20 - Usage Notes - 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)

You can call FNC_GetArrayElements first to get multiple values from an ARRAY and a corresponding NullBitVector. Then you can optionally modify both of these structures and use FNC_SetArrayElementsWithMultiValues to update the same range of elements in a different ARRAY that has the same ARRAY data type.

Alternatively, you can create your own newValues buffer and update an ARRAY using the values from the buffer as follows:

  1. Allocate the newValues buffer to be the size corresponding to the number of elements to be modified, based on the range specified in the arrayInterval input parameter. See Allocating the newValues Buffer.
  2. Fill the buffer with the desired element value for each element in the specified range, in row-major order. See Filling the newValues Buffer. You must allocate, initialize and set a corresponding NullBitVector to accompany the values in the newValues buffer. See Setting the NullBitVector. Then you can use FNC_SetArrayElementsWithMultiValues to update a range of values all at once.

This function provides performance benefits by allowing you to update potentially large sections of an ARRAY with few FNC calls. Otherwise, you would need to call FNC_SetArrayElements multiple times in order to set several individual elements to different new values.

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