15.10 - Integer Literals - Teradata Database

Teradata Database SQL Data Types and Literals

Teradata Database
Programming Reference

Declares literal strings of integer numbers in an expression.



Syntax element …

Specifies …

+, -

an optional sign.

The default is +.


any valid integer.

Integer literals consist of an optional sign followed by a sequence of digits. Spaces and new line characters are not allowed in a literal except after the optional sign.

The data type of an integer literal is determined by the range of the literal value. The type used is the smallest that can contain the value.


IF an integer literal fits in this range of values …

THEN the data type of the integer literal is …

-128 to 127


-32768 to -129



128 to 32767

-2147483648 to -32769



32768 to 2147483647

A numeric literal that is outside the range of the INTEGER type is assigned to the DECIMAL type, unless it is outside the range of values that a DECIMAL type can represent. For more information, see “Decimal Literals” on page 43.

Numeric literals are not assigned to the BIGINT type. If you need a numeric literal that is outside the range of the INTEGER type to be of a type other than DECIMAL, you can explicitly cast the literal to the desired type. For example, you can use the CAST function to explicitly cast a numeric literal to BIGINT:

   FROM PartsTbl 
   WHERE CustID = CAST(9876543210 AS BIGINT);

The following numbers are examples of integer literals.


FOR information on …


BYTEINT data types

“BYTEINT Data Type” on page 100.

SMALLINT data types

“SMALLINT Data Type” on page 102.

INTEGER data types

“INTEGER Data Type” on page 104.