Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

Exact Numeric Data Types

Syntax

exact_numeric_data_type ::

TINYINT

| SMALLINT

| INTEGER

| BIGINT

| NUMERIC | NUMBER [ ( precision [ , scale ] ) ]

| DECIMAL [(precision, scale)]

| MONEY [(precision[,scale])]

[ AUTO_INCREMENT [ ( ± seed , ± increment ) ] ]

[ IDENTITY [ ( ± seed , ± increment ) ] ]

Arguments

Type

Syntax

Description

Default

Range

TINYINT

TINYINT

An integer value one byte in length.

N/A

N/A

SMALLINT

SMALLINT

An integer value two bytes in length.

N/A

N/A

BIGINT

BIGINT

An integer value four bytes in length.

N/A

N/A

NUMBER

NUMERIC

| NUMBER

| DECIMAL

[ ( precision [ , scale ] ) ]

A number with the specified precision (maximum total number of digits) and scale (the number of digits to the right of the decimal point):

  • Precision must be an integer number >=scale and <= 32.
  • Scale must be an integer number >=0 and <= the precision.
  • Internally, the FairCom Database Engine always uses 32 digits of precision. Thus, the only reason to use a precision less than 32 is to limit the range of a number.
  • By default, NUMERIC columns have a precision of 32 and scale of 0.
  • If NUMERIC columns omit the scale, the default scale is 0.

Varies:

  • The maximum number of digits to the right of the decimal point is equal to the scale.
  • The maximum number of digits to the left of the decimal point is equal to the precision minus the scale.
  • For more information, see Exact Numeric Data Types Examples.

MONEY

MONEY [(precision[,scale])]

Equivalent to NUMERIC, except that the scale must be 2 or 4.

Precision = 32

Scale = 2

Precision = see NUMERIC

Scale = 2 or 4

N/A

[ IDENTITY

[ ( ± seed , ± increment ) ] ]

Not a field type, but an additional attribute for the field types to which it refers. See Exact Numeric Data Types Examples for more info.

N/A

N/A

N/A

[ AUTO_INCREMENT

[ ( ± seed , ± increment ) ] ]

Not a field type, but an additional attribute for the field types to which it refers. See Exact Numeric Data Types Examples for more info.

N/A

N/A

Numeric Literals

Literals are a type of expression that specify a constant value (they are also called constants). You can specify literals wherever FairCom DB SQL syntax allows expressions.

A numeric literal is a string of digits that FairCom DB SQL interprets as a decimal number. FairCom DB SQL allows the string to be in a variety of formats, including scientific notation.

Literals Syntax

[+|-]{[0-9][0-9]...}[.[0-9][0-9]...][[E|e][+|-][0-9]{[0-9]}]

Examples

The following are all valid numeric strings:

123

123.456

-123.456

12.34E-04

TOCIndex