17.10 - Integer Literals - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Data Types and Literals

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

Declares literal strings of integer numbers in an expression.


[ + | - ] n

Syntax Elements

+, -
An optional sign.
The default is +.
Any valid integer.

Components of Integer Literals

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.

Integer Literal Data Types

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 BYTEINT
-32768 to -129 SMALLINT
128 to 32767
-2147483648 to -32769 INTEGER
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.

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);

Examples: Integer Literals

The following numbers are examples of integer literals.


Related Information

FOR information on … SEE …
BYTEINT data types BYTEINT Data Type.
SMALLINT data types SMALLINT Data Type.
INTEGER data types INTEGER Data Type.