Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Register

Versions available for this page: CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 |

#### NUMERIC/DECIMAL

###### Description

NUMERIC or DECIMAL data types are used to represent fixed-point numbers. As an option, the total number of digits (precision) and the number of digits after the decimal point (scale) can be specified for definition. The minimum value for the precision p is 1. When the precision p is omitted, you cannot enter data whose integer part exceeds 15 digits because the default value is 15. If the scale s is omitted, an integer rounded to the first digit after the decimal point is returned because the default value is 0.

NUMERIC [(p [, s])]

###### Remark
• Precision must be equal to or greater than scale.
• Precision must be equal to or greater than the number of integer digits + scale.
• NUMERIC, DECIMAL, and DEC are used interchangeably.
• To check how the precision and the scale became changed when you operate with NUMERIC typed values, see "Arithmetic Operations and Type Casting of Numeric Data Types".
###### Example

If you specify 12345.6789 as NUMERIC, 12346 is stored (it rounds to the first place after the decimal point since 0 is the default value of scale).

If you specify 12345.6789 as NUMERIC(4), an error occurs (precision must be equal to or greater than the number of integer digits).

If you declare NUMERIC(3,4), an error occurs (precision must be equal to or greater than the scale).

If you specify 0.12345678 as NUMERIC(4,4), .1235 is stored (it rounds to the fifth place after the decimal point).

If you specify -0.123456789 as NUMERIC(4,4), -.1235 is stored (it rounds to the fifth place after decimal point and then prefixes a minus (-) sign).