INTEGER data type

The INTEGER data type is used to store integers that require 4 bytes of storage.

Syntax
[ UNSIGNED ] INTEGER
Remarks

The INTEGER data type is an exact numeric data type; its accuracy is preserved after arithmetic operations.

If you specify UNSIGNED, the integer can never be assigned a negative number. By default, the data type is signed.

The range for signed integers is -231 to 231 - 1, or -2147483648 to 2147483647.

The range for unsigned integers is 0 to 232 - 1, or 0 to 4294967295.

INTEGER can also be specified as INT. Regardless of which syntax is used, the data type is described as INTEGER.

When converting a string to a INTEGER, leading and trailing spaces are removed. If the leading character is '+' it is ignored. If the leading character is '-' the remaining digits are interpreted as a negative number. Leading '0' characters are skipped, and the remaining characters are converted to an integer value. An error is returned if the value is out of the valid range for the destination data type, if the string contains illegal characters, or if the string cannot be decoded as an integer value.

See also
Standards and compatibility
  • SQL/2003   Compatible with SQL/2003. The UNSIGNED keyword is a vendor extension.