VARIANT_TYPE Data Type | Data Types and Literals | Teradata Vantage - VARIANT_TYPE Data Type - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
tpf1598412463935.ditamap
dita:ditavalPath
tpf1598412463935.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantage™

An input parameter data type that can be used to package and pass in a varying number of parameters of varying data types to a UDF as a single UDF input parameter.

Vantage supports dynamic UDTs, which are structured UDTs with a pre-assigned UDT type name of VARIANT_TYPE, and whose structured type attribute composition is determined at run time.

The VARIANT_TYPE UDT can be used only as a UDF input parameter data type. When you declare a UDF input parameter to be of VARIANT_TYPE data type, you can use that parameter to pass in a varying number of parameters of varying types to the UDF.

The additional parameters are packaged and passed to the UDF as a single structured UDT. The number of parameters and the data types of the parameters are determined at runtime. Therefore, you can vary the parameter composition each time you invoke the routine.

To declare an instance of a VARIANT_TYPE UDT and define the runtime composition of the UDT, use the NEW VARIANT_TYPE expression. For more information, see Teradata Vantage™ - SQL Functions, Expressions, and Predicates, B035-1145. For information on declaring a UDF input parameter to be a VARIANT_TYPE data type, see CREATE FUNCTION and REPLACE FUNCTION in Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.

ANSI Compliance

VARIANT_TYPE is a Teradata extension to the ANSI SQL standard.

Syntax

parameter_name VARIANT_TYPE

Syntax Elements

parameter_name
The name of an input parameter declared in a UDF.