15.10 - Data Types on Which Implicit Conversion is Performed - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

prodname
Teradata Database
vrm_release
15.10
created_date
March 2017
category
Programming Reference
featnum
B035-1145-151K

If operand data types differ, Teradata Database performs an implicit conversion according to the following table. Implicit conversions are Teradata extensions to the ANSI SQL:2011 standard.

Comparisons between character and numeric data types require that the character field be convertible to a numeric value.

IF one expression operand is … AND the other expression operand is … THEN Teradata Database compares the data as …
Character Character Character.

For more details, see “Character String Comparisons”.

Date Date.

Teradata Database returns an error for character data with GRAPHIC server character set.

BYTEINT
SMALLINT
INTEGER
FLOAT FLOAT.

Teradata Database returns an error for character data with GRAPHIC server character set.

Period Period.
CHAR(k)
VARCHAR(k))

WHERE k <= 16

BIGINT
DECIMAL(m,n) FLOAT.

Teradata Database returns an error for character data with GRAPHIC server character set.

CHAR(k)
VARCHAR(k)

where k > 16

DECIMAL(m,n)

where m <= 16

FLOAT.

Teradata Database returns an error for character data with GRAPHIC server character set.

BIGINT
DECIMAL(m,n)

where m > 16

Teradata Database returns an error.
CHAR(k)
VARCHAR(k) NUMBER and k <=16 FLOAT.

Teradata Database returns an error for character data with GRAPHIC server character set.

NUMBER and k > 16 Teradata Database returns an error.
BYTEINT SMALLINT SMALLINT.
BYTEINT
SMALLINT INTEGER INTEGER.
BYTEINT
SMALLINT
INTEGER
BIGINT BIGINT BIGINT.
BYTEINT DECIMAL(m,n)

where m <= 18 and m-n >= 3

DECIMAL(18,n).
SMALLINT DECIMAL(m,n)

where m <= 18 and m-n >= 5

INTEGER DECIMAL(m,n)

where m <= 18 and m-n >= 10

DATE
BYTEINT DECIMAL(m,n)

where m > 18 or m-n < 3

DECIMAL(38,n).
SMALLINT DECIMAL(m,n)

where m > 18 or m-n < 5

INTEGER DECIMAL(m,n)

where m > 18 or m-n < 10

DATE
BIGINT DECIMAL(m,n)
DECIMAL(m,n) DECIMAL(k,j)

where max(m-n,k-j) + max(j,n) <= 18

DECIMAL(18,max(j,n)).
DECIMAL(k,j)

where max(m-n,k-j) + max(j,n) > 18

DECIMAL(38,max(j,n)).
BYTEINT
SMALLINT
INTEGER
BIGINT
DECIMAL(m,n)
NUMBER(m,n)
NUMBER(m)
NUMBER(*,n)
NUMBER NUMBER(k,j)
NUMBER(k)
NUMBER(*,j)
NUMBER NUMBER
DATE BYTEINT
SMALLINT
INTEGER INTEGER.
BIGINT BIGINT.
FLOAT FLOAT.
FLOAT BYTEINT
SMALLINT
INTEGER
BIGINT
DECIMAL(m,n)
NUMBER(m,n)
NUMBER(m)
NUMBER(*,n)
NUMBER FLOAT.
Period Character Period.