Example: UDT and a One-Dimensional ARRAY Type - Analytics Database - Teradata Vantage

SQL Data Definition Language Syntax and Examples

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
2024-10-04
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

This example first creates a structured UDT named employee and then creates ARRAY types based on it using both Teradata-style and Oracle-style syntax.

     CREATE TYPE employee AS (
       first_name  CHARACTER(10),
       last_name   CHARACTER(10),
       employee_id INTEGER)
       …;

The first example creates the ARRAY type structudt_ary , which is based on employee, using Teradata-style syntax.

     CREATE TYPE structudt_ary AS 
     employee ARRAY[20];

The next example creates the same ARRAY type as a VARRAY type using Oracle-style syntax.

     CREATE TYPE structudt_ary AS 
     VARRAY(20) OF employee;