Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Data Types » Numeric data types

INTEGER data type Next Page

NUMERIC data type


The NUMERIC data types is used to store decimal numbers with precision total digits and with scale digits after the decimal point.

Syntax

NUMERIC [ ( precision [ , scale ] ) ]

Parameters

precision    An integer expression between 1 and 127, inclusive, that specifies the number of digits in the expression. The default setting is 30.

scale    An integer expression between 0 and 127, inclusive, that specifies the number of digits after the decimal point. The scale value should always be less than or equal to the precision value. The default setting is 6.

The defaults can be changed by setting database options. For information, see precision option [database] and scale option [database].

Remarks

The NUMERIC data type is an exact numeric data type; its accuracy is preserved to the least significant digit after arithmetic operations.

The number of bytes required to store a decimal number can be estimated as

2 + int( (before+1)/2 ) + int( (after+1)/2 )

The function int takes the integer portion of its argument, and before and after are the number of significant digits before and after the decimal point. The storage is based on the value being stored, not on the maximum precision and scale allowed in the column.

NUMERIC is semantically equivalent to DECIMAL.

See also
Standards and compatibility