17.10 - Example - 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)

Consider the following table definitions, where euro and us_dollar are UDTs:

CREATE TABLE euro_sales_table
   (euro_quarter INTEGER
   ,euro_region VARCHAR(20)
   ,euro_sales euro );
CREATE TABLE us_sales_table
   (us_quarter INTEGER
   ,us_region VARCHAR(20)
   ,us_sales us_dollar );

Assuming an appropriate cast definition exists for converting the euro UDT to a us_dollar UDT, the following statement performs a us_dollar UDT to euro UDT conversion:

INSERT INTO euro_sales_table
   SELECT us_quarter, us_region, CAST (us_sales AS euro) 
   FROM us_sales_table;