Navigation:  NexusDB Guide > SQL Reference > SQL Data Types >

Numeric Types

Previous pageReturn to chapter overviewNext page

NexusDB V3 Manual

Numeric Types

button_main button_prev button_next

NexusDB Manual V3 > SQL Reference > SQL Data Types

Syntax

 

<numeric type> ::=

<exact numeric type> ::=

 

 

|

|

|

|

|

|

|

|

|

|

|

|

|

 

NUMERIC [ ( precision [ , scale ] ) ]

DECIMAL [ ( precision [ , scale ] ) ]

DEC [ ( precision [ , scale ] ) ]

BYTE

TINYINT

SHORTINT

SMALLINT

INTEGER

INT

AUTOINC [ ( start-value [ , increment-value ] ) ]

BIGINT

LARGEINT

WORD

DWORD

<approximate numeric type> ::=

 

 

|

|

|

|

 

FLOAT [ ( precision ) ]

REAL

DOUBLE PRECISION

EXTENDED

MONEY

 

Notes

 

§

The exact numeric types can represent a numeric value exactly. The unsigned and signed integer types have an implicit scale of 0, while the NUMERIC and DECIMAL types have both a precision (the number of significant digits) and a scale (the fractional component).

 

§

DECIMAL is a BCD type with a maximum precision of 16-20, depending on the scale, and a maximum scale of 4. A scale of 0 is implicit if the scale argument is omitted, and a precision of 16 is implicit if also the precision argument is omitted.

 

§

NUMERIC is equivalent to DECIMAL.

 

§

BYTE and TINYINT are equivalent NexusDB-specific 8-bit unsigned integer types with range 0 .. 255.

 

§

SHORTINT is a NexusDB-specific 8-bit signed integer type with range -128..127.

 

§

SMALLINT is a 16-bit signed integer type with range -32768..32767.

 

§

INTEGER is a 32-bit signed integer type with range -2147483648..2147483647.

 

§

INT is equivalent to INTEGER.

 

§

AUTOINC is a NexusDB-specific 32-bit unsigned integer type with range 0..4294967295, suitable for identity columns. A start value of 1 is implicit if start-value is not specified. An increment value of 1 is implicit if increment-value is not specified.

 

§

BIGINT is a 64-bit integer type with range -2E63..2E63-1.

 

§

LARGEINT is a NexusDB synonym for BIGINT.

 

§

WORD is a NexusDB-specific unsigned 16-bit integer type with range 0..65535.

 

§

DWORD is a NexusDB-specific unsigned 32-bit integer type with range 0..4294967295

 

§

The approximate numeric types are floating point values that can only represent numbers approximately.

 

§

FLOAT is a 4 byte floating point type with range -1.5E-45..3.4E38. The option of specifying the precision is included for syntax compatibility with SQL:2003, but does not have any affect on the actual precision.

 

§

DOUBLE PRECISION is an 8 byte floating point type with range 5.0E-324..1.7E308.

 

§

REAL is equivalent to DOUBLE PRECISION.

 

§

EXTENDED is a NexusDB-specific 10 byte floating point type with range 3.6E-4951..1.1E4932.

 

§

MONEY is a NexusDB-specific type that is stored as a 64-bit scaled integer with the last 4 digits representing the fractional component.

 

§

Any two numbers are comparable.

 

§

A number is assignable only to numeric sites. An exception is raised if an assignment of a numeric value would lead to a loss of its most significant digit. When a numeric value is assigned to a site of exact numeric type, the value is converted to have the precision and scale of the target, with truncation of the fractional component if the scale is reduced.

 

 


Conformance

 

SQL:2003 standard

 

 

NexusDB extensions

-

-

 

-

-

-

-

-

-

-

-

-

Core SQL

Feature T071 "BIGINT data type"

 

BYTE

TINYINT

SHORTINT

AUTOINC

LARGEINT

WORD

DWORD

EXTENDED

MONEY

 

© Nexus Database Systems Pty Ltd.

nexus_logo