Examples | ARRAY Data Type | Teradata Vantage - 17.10 - Example: Creating an ARRAY Data Type - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)

The following statement uses Teradata syntax to create a 1-D ARRAY type with 5 elements of type CHAR(10). All elements of the array are initialized to null.

CREATE TYPE phonenumbers_ary AS CHAR(10) ARRAY[5] DEFAULT NULL;

The following statement uses Oracle-compatible syntax to create a 1-D ARRAY type with 5 elements of type CHAR(10). All elements of the array are set to an uninitialized state.

CREATE TYPE phonenumbers_ary AS VARRAY(5) OF CHAR(10);

Consider the following structured UDT:

CREATE TYPE measures_UDT AS(amplitude INTEGER,
                            phase     INTEGER,
                            frequency INTEGER);
The following statement uses Teradata syntax to create a 3-D ARRAY type with elements of type measures_UDT. The scope of this array is composed of three dimensions:
  • Dimension one has a lower bound of 1 and an upper bound of 5.
  • Dimension two has a lower bound of 1 and an upper bound of 7.
  • Dimension three has a lower bound of 1 and an upper bound of 20.
    CREATE TYPE seismic_cube AS measures_UDT ARRAY [1:5][1:7][1:20];

The following statement uses Oracle-compatible syntax to create the same 3-D ARRAY type.

CREATE TYPE seismic_cube AS VARRAY (1:5)(1:7)(1:20) OF measures_UDT;