The integer data types

The database server supports the following data types for integer values.
SQL integer data type Number of bytes Range of values
SMALLINT 2 -32767 to 32767
INTEGER, INT, SERIAL 4 -2,147,483,647 to 2,147,483,647
INT8, BIGINT, SERIAL8, BIGSERIAL 8 -9,223,372,036,854,775,807 to 9,223,372,036,854,775,807

The C language supports the short int and long int data types for integer values.

The storage size of the C short int data type depends on the hardware and operating system of the computer that you use.

In ESQL/C, the long int data type of C is always treated as 4 bytes, regardless of the platform or hardware. This makes long int useful for storing values of the SMALLINT, INTEGER, INT, and SERIAL data types of HCL OneDB™.

Important:

Do not, however, attempt to use a long int data type to store the 8-byte HCL OneDB integer data types INT8, BIGINT, SERIAL8, or BIGSERIAL. For example, the database server issues this error when your query attempts to select an 8-byte BIGSERIAL value outside the range of -2,147,483,647 through + 2,147,483,647 into an integer C variable whose data type is long int:

-1215  Value too large to fit in an INTEGER.

When you declare an integer host variable, you must ensure that this host variable is large enough for all possible values of the SQL integer data type with which the variable is associated. For 8-byte whole numbers, use host variables of the C data types bigint or int8. For more information about how to implement integer data types on your system, check with your system administrator or your C documentation.