The Oracle DECIMAL data type provides high-precision decimal value storage for calculations that require precise calculations. Features include: Configurable precision, variable length between 1 and 38, depending on precision and range High precision, accurate calculation of currency, scientific data, etc. Immutable, value cannot be changed after creation
DECIMAL data type in Oracle
The DECIMAL data type is used to store high-precision decimal values when precise calculations of monetary, financial or scientific data are required. very useful.
Features
Syntax
Create DECIMAL column:
<code class="sql">CREATE TABLE my_table ( decimal_column DECIMAL(precision, scale) );</code>
Where:
precision
is the sum of the number of decimal places and integer places (maximum 38). scale
is the number of decimal places (maximum precision). Example
Store a currency value with two decimal places:
<code class="sql">CREATE TABLE orders ( price DECIMAL(8, 2) );</code>
Store a timestamp accurate to milliseconds:
<code class="sql">CREATE TABLE events ( timestamp DECIMAL(20, 6) );</code>
Advantages
Disadvantages
The above is the detailed content of Decimal usage in oracle. For more information, please follow other related articles on the PHP Chinese website!