Accessing Information About ARRAY Elements - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

Teradata provides the following library functions to retrieve information about an ARRAY argument, such as the number of elements present, the element data type, and the number of dimensions in the ARRAY.

  • FNC_GetArrayElementCount
  • FNC_GetArrayNumDimensions
  • FNC_GetArrayTypeInfo

Call FNC_GetArrayElementCount to get the total number of elements that are set to a value (including NULL), and the index to the last element that is present in the ARRAY.

Call FNC_GetArrayNumDimensions to get the number of dimensions defined for an ARRAY type when this information is not known to the external routine. This enables the writer of the external routine to write code so that it is dimension independent for any ARRAY types accessed in the routine.

FNC_GetArrayTypeInfo returns information about an ARRAY argument as follows:

  • The number of dimensions defined for the ARRAY.
  • The total number of elements (across all dimensions) defined for the ARRAY. This is also known as the maximum cardinality of the ARRAY.
  • The data type of the elements. If the element type is UDT, the function also provides the UDT type and UDT type name.
  • The maximum length in bytes of an element value.
  • The precision and scale values for certain element types, such as DECIMAL.
  • The server character set associated with the element if the element is a character type.
  • The scope of each dimension of the ARRAY.

For detailed information about these functions, see C Library Functions.