NUMBER Datatype
The NUMBER datatype stores fixed and floating-point numbers. Numbers of virtually any magnitude can be stored and are guaranteed portable among different systems operating Oracle Database, up to 38 digits of precision.
The following numbers can be stored in a NUMBER column:
- Positive numbers in the range 1 x 10-130 to 9.99…9 x 10125 with up to 38 significant digits
- Negative numbers from -1 x 10-130 to 9.99…99 x 10125 with up to 38 significant digits
- Zero
- Positive and negative infinity (generated only by importing from an Oracle Database, Version 5)
For numeric columns, you can specify the column as:
column_name NUMBER
Optionally, you can also specify a precision (total number of digits) and scale (number of digits to the right of the decimal point):
column_name NUMBER (precision, scale)
If a precision is not specified, the column stores values as given. If no scale is specified, the scale is zero.
Oracle guarantees portability of numbers with a precision equal to or less than 38 digits. You can specify a scale and no precision:
column_name NUMBER (*, scale)
In this case, the precision is 38, and the specified scale is maintained.
When you specify numeric fields, it is a good idea to specify the precision and scale. This provides extra integrity checking on input.
If you specify a negative scale, Oracle Database rounds the actual data to the specified number of places to the left of the decimal point. For example, specifying (7,-2) means Oracle Database rounds to the nearest hundredths, as shown in Table 26-1.
Table 26-1 How Scale Factors Affect Numeric Data Storage
| Input Data | Specified As | Stored As |
|---|---|---|
| 7,456,123.89 | NUMBER |
7456123.89 |
| 7,456,123.89 | NUMBER(*,1) |
7456123.9 |
| 7,456,123.89 | NUMBER(9) |
7456124 |
| 7,456,123.89 | NUMBER(9,2) |
7456123.89 |
| 7,456,123.89 | NUMBER(9,1) |
7456123.9 |
| 7,456,123.89 | NUMBER(6) |
(not accepted, exceeds precision) |
| 7,456,123.89 | NUMBER(7,-2) |
7456100 |
http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/datatype.htm#i16209