Example: Creating a Structured UDT from Predefined Data Types - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

This example creates a structured UDT named person from four predefined data types and the structured UDT address, making it a 2-level nested type. The UDT is nested because the type address is a structured UDT having two attributes. In this case, both of those attributes are predefined types, but if one or more of them had been a structured type, person would be a 3-level nested type.

    CREATE TYPE SYSUDTLIB.person AS (
       ssn         CHARACTER(11), 
       first_name  VARCHAR(20),
       middle_name VARCHAR(20),
       last_name   VARCHAR(20),
       domicile    address ) 
    NOT FINAL;