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
Published
July 2021
Language
English (United States)
Last Update
2021-08-13
dita:mapPath
fsi1592016213432.ditamap
dita:ditavalPath
fsi1592016213432.ditaval

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;