The NUMBER datatype is used for declaring both fixed-point and floating-point numbers.
The NUMBER datatype can be used to represent numbers in the range 1.0E-123 through 9.99E125.
The NUMBER datatype allows for up to 38 decimal digits of precision.
The Syntax for the NUMBER Datatype
variable_name NUMBER [(precision[,scale])]
variable_name is whatever name you want to give this variable.
precision specifies the number of decimal digits used to represent the value internally.
precision range is 1 to 38.
the default for precision rangeis 38.
scale indicates where the decimal point is and where rounding occurs.
The range for scale is -84 to 127, and the default is zero.
precision as telling you how many digits are used to represent the number.
scale tells you where the decimal point is.
Both precision and scale are optional.
The NUMBER datatype is overloaded to include three different numeric groups:
Integers ( NUMBER with only precision) are between -10^38 and 10^38 not including either of the bounds.
Fixed-point values (NUMBER both precision and scale) are between -10^122 and 10^122, not including either of the bounds and can be as small as 10^ C127.
Floating-point values (you don't specify anything) are between -10^130 and 10^130, not including either of the bounds and can be as small as 10^ C127.
For example,
dollar_amount NUMBER (5,2);
myNumber NUMBER (3);
myNumber2 NUMBER(5,-2);
myNumber3 NUMBER (1,6)
21.14.Number | ||||
21.14.1. | NUMBER | |||
21.14.2. | NUMBER Subtypes | |||
21.14.3. | Identical declarations using NUMBER subtypes. | |||
21.14.4. | Number type variable | |||
21.14.5. | Assign value to NUMBER type variable | |||
21.14.6. | NATURAL value Computation | |||
21.14.7. | Assigning a Fraction to an Integer | |||
21.14.8. | Setting Precision and Scale | |||
21.14.9. | NUMBER(1,-2): Variable with a scale of -2 can only hold values like 100,200,300... up to 900. | |||
21.14.10. | NUMBER Data type: integer, fixed point and floating point | |||
21.14.11. | Select a number value from a table into a variable and output it | |||
21.14.12. | IF statement with number value check |