Integer Literals - Teradata Vantage - Analytics Database

SQL Data Types and Literals

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
uds1628112204571.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
exs1472253032394
lifecycle
latest
Product Category
Teradata Vantage™

Declares literal strings of integer numbers in an expression.

Syntax

[ + | - ] n

Syntax Elements

+, -
An optional sign.
The default is +.
n
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:

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

Examples: Integer Literals

The following numbers are examples of integer literals.

12
0
-5

Related Information

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