17.10 - Example: CAST - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Operators and User-Defined Functions

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

The following statement creates a table that defines a euro column named sales :

CREATE TABLE swiss_sales
  (location address
  ,sales euro);

The following statement uses CAST to return a euro UDT expression. Using CAST requires a cast definition that converts the DECIMAL(8,2) predefined type to a euro type.

INSERT INTO swiss_sales
   SELECT location, CAST (sales AS euro)
   FROM european_sales
   WHERE region = 1038;