Approximate Numeric Data Types

An approximate numeric data type represents numeric values approximately.
(1)
Approximate Numeric Data Type

1 
2.1 DECIMAL
2.1 DEC
2.1 NUMERIC
2.1! 1 (16)
2.1  ( precision )
1 
2.1 FLOAT
2.1 DOUBLE PRECISION
1? (float_precision)
2.1 1 SMALLFLOAT
2.1 REAL
Notes:
  • 1 HCL OneDB™ extension
Element Description Restrictions Syntax
float_precision The float_precision is ignored, but is ANSI/ISO compliant. Must be a positive integer. Specified value has no effect. Literal Number
precision Significant digits. Default is 16. An integer; 1 < precision < 32 Literal Number

Use approximate numeric data types for very large and very small numbers that can tolerate some degree of rounding during arithmetic operations.

The following table summarizes the built-in approximate numeric data types.
Data Type Description
DEC(p) Synonym for DECIMAL(p)
DECIMAL(p)

Stores floating-point decimal values in the approximate range from 1.0E-130 to 9.99E+126

The p parameter specifies the precision. If no precision is specified, the default is 16. This floating-point data type is available as an approximate numeric type only in a database that is not ANSI-compliant. In an ANSI-compliant database, DECIMAL(p) is implemented as a fixed-point DECIMAL; see Exact Numeric Data Types.

DOUBLE PRECISION ANSI-compliant synonym for FLOAT. The float_precision term is not valid when you use this synonym in data type declarations.
FLOAT Stores double-precision floating-point numbers with up to 16 significant digits. The float-precision parameter is accepted in data-type declarations for compliance with the ANSI/ISO standard for SQL, but this parameter has no effect on the actual precision of values that the database server stores.
NUMERIC(p) ANSI-compliant synonym for DECIMAL(p) In an ANSI-compliant database, this is implemented as an exact numeric type, with the specified precision and a scale of zero, rather than an approximate numeric (floating-point) data type.
REAL ANSI-compliant synonym for SMALLFLOAT
SMALLFLOAT Stores single-precision floating-point numbers with approximately 8 significant digits

The built-in number data types of HCL OneDB database servers support real numbers. They cannot directly store imaginary or complex numbers.

In HCL OneDB, you must create a user-defined data type for applications that support values that can have an imaginary part.

No more than nine arguments to an external UDR can be DECIMAL data types of SQL that the UDR declares as BigDecimal data types of the Java™ language.