BIGINT Type
The BIGINT data type represents 8-byte signed integer numbers, allowing storage of very large whole numbers within a wide range.
Syntax
BIGINT
Limits
The BIGINT data type represents 8-byte signed integer numbers. It is capable of storing large whole numbers, both positive and negative, within the following range: [-9,223,372,036,854,775,807 to 9,223,372,036,854,775,807]
Literals
BIGINT literals are expressed as whole numbers without quotes or decimal points.
Examples of valid literals:
9223372036854775807 (maximum value)
-9223372036854775807 (minimum value)
Values outside this range are invalid and will result in an overflow error.
Examples
-- Example 1: Using BIGINT literals
> SELECT 9223372036854775807;
9223372036854775807
> SELECT -9223372036854775807;
-9223372036854775807
-- Example 2: Casting to BIGINT
> SELECT CAST(123456789 AS BIGINT);
123456789
> SELECT CAST('987654321' AS BIGINT);
987654321
-- Example 3: Arithmetic with BIGINT
> SELECT 9223372036854775807 - 1 AS result;
9223372036854775806
-- Example 4: Handling invalid BIGINT values
> SELECT CAST(10000000000000000000 AS BIGINT);
<error: value out of range for type BIGINT>
> SELECT 9223372036854775807 + 1;
<error: arithmetic overflow>