Example: Creating Tables and Set Elements in a 1-D Array - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

Consider the following 1-D ARRAY data type:

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

The following statement creates a table with a column named ephone with a data type of phonenumbers_ary.

CREATE TABLE my_table (eno INTEGER, ephone phonenumbers_ary);

The following statement uses an ARRAY element reference to set element 3 of the array to the value '5551234567'. If elements 1 and 2 in the array were not initialized, this UPDATE statement automatically sets those elements to null.

UPDATE my_table
SET ephone[3] = '5551234567';