Exact Numeric Data Types

An exact numeric data type stores numbers of a specified precision and scale.
(1)
Exact Numeric Data Type

1 
2.1 DECIMAL
2.1 DEC
2.1 NUMERIC
1?  ( precision
2.1!  ,
0 
2.1?  , scale
1 )
1 1 MONEY
2.1!  (16, 2)
2.1?  ( precision
2.2.1!  ,
2
2.2.1?  , scale
2.1 )
2.1 BIGINT
2.1 INT
2.1 INTEGER
2.1 1 INT8
1  SMALLINT1
2.1 
2.1 
2.2.1 BIGSERIAL
2.2.1  SERIAL
2.2.1  SERIAL8
2.2.1!  (1)
2.2.1?  ( start )
Notes:
  • 1 HCL OneDB™ extension
Element Description Restrictions Syntax
precision Significant digits Must be an integer; 1 < precision < 32 Literal Number
scale Digits in fractional part Must be an integer; 1 < scale < precision Literal Number
start Integer starting value For SERIAL: 1 < start < 2,147,483,64; For BIGSERIAL and SERIAL8: 1 < start < 9,223,372,036,854,775,807 Literal Number

The precision of a data type is the number of digits that the data type stores. The scale is the number of digits to the right of the decimal separator.

The following table summarizes the exact numeric data types available.
Data Type Description
DEC(p,s) Synonym for DECIMAL(p,s)
DECIMAL(p,s) Stores fixed-point decimal values of real numbers, with up to 30 significant digits in the fractional part, or up to 32 significant digits to the left of the decimal point.
INT Synonym for INTEGER
INTEGER Stores a 4-byte integer value. These values can be in the range from -(231-1) to 231-1 (from -2,147,483,647 to 2,147,483,647).
BIGINT and INT8 Stores an 8-byte integer value. These values can be in the range from -(263-1) to 263-1 (the range -9,223,372,036,854,775,807 to 9,223,372,036,854,775,807). BIGINT has storage and processing advantages over INT8.
MONEY(p,s) Stores fixed-point currency values. These values have same internal data format as a fixed-point DECIMAL(p,s) value.
NUMERIC(p,s) ANSI-compliant synonym for DECIMAL(p,s)
SERIAL Stores a 4-byte positive integer that the database server generates. Values can range from 1 to 231-1 (that is, from 1 to 2,147,483,647).
BIGSERIAL and SERIAL8 Stores an 8-byte positive integer value that the database server generates. Values can range from 1 to 263-1 (that is, from 1 to 9,223,372,036,854,775,807). BIGSERIAL has storage and processing advantages over SERIAL8.
SMALLINT Stores a 2-byte integer value. These values can be in the range from -(215-1) to 215-1 (that is, from -32,767 to 32,767).