Data Type Phrases | Data Types and Literals | Teradata Vantage - 17.10 - Data Type Phrases - 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)

A data type phrase (data_type_declaration) determines the type of data to store in a column of a table on SQL Engine. When you create a table, you must specify a data type phrase for each column. A column does not have a default data type.

You can also use data type phrases to specify data conversions, casts in expressions, parameter types, and so forth.

The following table shows typical data type phrases you can use to define various data types.

Data Type ANSI SQL Teradata Extension to ANSI SQL
Array  
ARRAY/VARRAY   X
Byte  
BLOB[(n)] X  
BYTE[(n)]   X
VARBYTE[(n)]   X
Numeric  
BIGINT X  
BYTEINT   X
DATE a   X
DECIMAL [(n[,m])] X  
DOUBLE PRECISION X  
FLOAT X  
INTEGER X  
NUMBER(n[,m])   X
NUMBER[(*[,m])]   X
NUMERIC [(n[,m])] X  
REAL X  
SMALLINT X  
DateTime  
DATE X  
TIME [(n)] X  
TIMESTAMP [(n)] X  
Interval  
INTERVAL X  
INTERVAL DAY [(n)] X  
INTERVAL DAY [(n)] TO HOUR X  
INTERVAL DAY [(n)] TO MINUTE X  
INTERVAL DAY [(n)] TO SECOND X  
INTERVAL HOUR [(n)] X  
INTERVAL HOUR [(n)] TO MINUTE X  
INTERVAL HOUR [(n)] TO SECOND X  
INTERVAL MINUTE [(n)] X  
INTERVAL MINUTE [(n)] TO SECOND [(m)] X  
INTERVAL MONTH X  
INTERVAL SECOND [(n,[m])] X  
INTERVAL YEAR [(n)] X  
INTERVAL YEAR [(n)] TO MONTH X  
Character  
CHAR[(n)] X  
CHARACTER(n) CHARACTER SET GRAPHIC   X
CLOB X  
CHAR VARYING(n) X  
LONG VARCHAR   X
LONG VARCHAR CHARACTER SET GRAPHIC   X
VARCHAR(n) X  
VARCHAR(n) CHARACTER SET GRAPHIC   X
Period  
PERIOD(DATE)   X
PERIOD(TIME [(n)])   X
PERIOD(TIMESTAMP [(n)])   X
UDT  
udt_name X  
Parameter Types  
TD_ANYTYPE   X
VARIANT_TYPE   X
  • DATE is supported both in its Teradata form and in the preferred ANSI DateTime form. For new development, define DATE using ANSI DATE type.
  • The CREATE TYPE statement determines the name of a UDT.

For details on the different level of ANSI compliance, see Teradata Vantageā„¢ - SQL Fundamentals, B035-1141