Numeric
NUMBER(n,m) accepts numeric data, including zero, negative, and positive numbers.
n specifies the maximum number of digits on either side of the decimal point.
m specifies the total number of digits to the right of the decimal point.
Both n and m are optional.
n defaults to the maximum value.
m defaults to zero.
The value for n can range from 1 to 38.
The value for m can range from -84 to 127.
Examples of NUMBER Precision and Scale
| Datatype | Value Entered | Value Stored As |
|---|---|---|
| NUMBER | 1.23 | 1.23 |
| NUMBER(2) | 4.56 | 5 |
| NUMBER(5,2) | 1.23 | 1.23 |
| NUMBER(5,2) | 4.5678 | 4.57 |
| NUMBER(3,2) | 99.56 | Error code ORA-01438: "value larger than specified precision allowed for this column". |
| NUMBER(5,-2) | 1056.34 | 1100 |
NUMBER Datatype Examples
| Example | Description |
|---|---|
| NUMBER(4) | An integer with a maximum length of four digits |
| NUMBER(6,2) | A number with a maximum precision of six digits; at most two digits behind the decimal point |
| NUMBER(7,-3) | A multiple of thousand with at most seven digits NUMBER Identical to NUMBER(38,*) |
| NUMBER(*,5) | Identical to NUMBER(38,5) |