Syntax - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantage™
void
FNC_GetStructuredAttributeInfo ( UDT_HANDLE        udtHandle,
                                 int               attributePosition,
                                 int               bufSize,
                                 attribute_info_t *attributeArray )
attributeArray
Defined in sqltypes_td.h as:
typedef struct attribute_info_t
{
   INTEGER          attrIndex;
   dtype_et         data_type;
   CHARACTER        attribute_name[256];
   SMALLINT         udt_indicator;
   CHARACTER        udt_type_name[256];
   INTEGER          max_length;
   FNC_LobLength_t  lob_length;
   SMALLINT         total_interval_digits;
   SMALLINT         num_fractional_digits;
   charset_et       charset_code;
} attribute_info_t;

Syntax Elements

udtHandle
Handle to a structured UDT that is defined to be an input parameter to an external routine.
attributePosition
Whether this call returns information about one or all of the attributes:
attributePosition Description
0 or greater Value identifies position of attribute in structured UDT for which this call returns information. Position of first attribute is 0.
-1 Call returns information about all attributes.
bufSize
Size in bytes that was allocated to the attributeArray argument.
attributeArray
Array of one or more attribute_info_t structures that describe the requested attribute or attributes in the structured UDT, as specified by attributePosition.
attrIndex
Specifies the position of the attribute in the structured type, where the position of the first attribute is 0.
data_type
Specifies the data type of the attribute. The sqltypes_td.h header file defines dtype_et as:
typedef int dtype_et;
Valid values are defined by the dtype_en enumeration in sqltypes_td.h. For a list of the valid values, see the dtype argument in FNC_CallSP.
attribute_name
Specifies the attribute name.
For dynamic UDTs with attributes that are defined by column names and no , the attribute name is the column name.
udt_indicator
Specifies whether the attribute is a UDT and if so, which kind:
udt_indicator UDT Kind
0 Not a UDT
1 Structured UDT
2 Distinct UDT
3 Teradata proprietary internal UDT
5 JSON attribute
udt_type_name
Specifies the UDT type name associated with the attribute. Meaningful only if the attribute is a UDT.
max_length
Specifies the maximum length in bytes of the value of the attribute:
Attribute Type max_length
Non-LOB Size in bytes of buffer you must allocate before calling FNC_GetStructuredAttribute to get attribute value.
LOB LOB_REF length

lob_length provides length of LOB data itself.

JSON Maximum length of JSON attribute.
lob_length
Specifies the length of a LOB attribute. Meaningful only if the attribute is a LOB.
For a JSON attribute, lob_length specifies the maximum possible length of the JSON attribute in bytes if the data is stored as a LOB; otherwise, this value is 0.
You can use lob_length as the length of the LOB object that you pass to FNC_LobOpen when you establish a read context for the LOB attribute.
total_interval_digits
Specifies the precision of certain attributes. The value of total_interval_digits corresponds to the n value of the following types:
  • DECIMAL(n, m)
  • INTERVAL YEAR(n)
  • INTERVAL YEAR(n) TO MONTH
  • INTERVAL MONTH(n)
  • INTERVAL DAY(n)
  • INTERVAL DAY(n) TO HOUR
  • INTERVAL DAY(n) TO MINUTE
  • INTERVAL DAY(n) TO SECOND(m)
  • INTERVAL HOUR(n)
  • INTERVAL HOUR(n) TO MINUTE
  • INTERVAL HOUR(n) TO SECOND(m)
  • INTERVAL MINUTE(n)
  • INTERVAL MINUTE(n) TO SECOND(m)
  • INTERVAL SECOND(n, m)
If the data type of the attribute does not appear in the preceding list, total_interval_digits is not meaningful for the attribute.
num_fractional_digits
Specifies the precision or scale of certain attributes. The value of num_fractional_digits corresponds to the m value of the following types:
  • DECIMAL(n, m)
  • TIME(m)
  • TIME(m) WITH TIME ZONE
  • TIMESTAMP(m)
  • TIMESTAMP(m) WITH TIME ZONE
  • INTERVAL DAY(n) TO SECOND(m)
  • INTERVAL HOUR(n) TO SECOND(m)
  • INTERVAL MINUTE(n) TO SECOND(m)
  • INTERVAL SECOND(n, m)
If the data type of the attribute does not appear in the preceding list, num_fractional_digits is not meaningful for the attribute.
charset_code
Specifies the server character set associated with the attribute. Meaningful only if the attribute is a character type.
The sqltypes_td.h header file defines charset_et as:
typedef int charset_et;
Valid values are defined by the charset_en enumeration in sqltypes_td.h:
typedef enum charset_en
{
   UNDEF_CT=0,
   LATIN_CT=1,
   UNICODE_CT=2,
   KANJISJIS_CT=3,
   KANJI1_CT=4
} charset_en; 
For a JSON attribute, charset_code is LATIN_CT or UNICODE_CT depending on how the JSON attribute was defined.