INTEGER

32-bit signed two’s complement integer that has a minimum value of -2^31 and a maximum value of 2^31-1.

LITERAL NOTATION: Integers can be expressed either in decimal or hexadecimal notation:

decimal: -2147483648 to 2147483647
hexadecimal: 0x0 to 0xFFFFFFFF

Converting to integer

1
2
3
INT(string_expr)
INT(numeric_expr)
INT(timestamp_expr)
  1. Converts a STRING value to integer
  2. Converts a numeric value (LONG, FLOAT or DOUBLE) to integer
  3. Converts a TIMESTAMP or TIMESTAMP_NANO value to integer

See also

Cast

Integer expressions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
2 > 1          // => TRUE
2 < 1          // => FALSE
2 = 2          // => TRUE
2 >= 1         // => FALSE
2 <= 3         // => TRUE
2 + 1          // => 3
1 - 1          // => 0
2 * 2          // => 4
2 / 2          // => 1
5 % 2          // => 1
1 & 0          // => 0
1 | 0          // => 1
1 ^ 1          // => 0
1 << 1         // => 2
1 >> 1         // => 0
1 >>> 1        // => 0
~ 1            // => -2
BIT_COUNT(1)   // => 1

Parsing integers

1
2
INT:fieldname
HEXINT:fieldname

See also

INT, INTEGER, HEXINT