There are four ways to complement an integer to two decimal points in Oracle: using the TO_CHAR() function, using the LPAD() and SUBSTR() functions, using the TO_NUMBER() and TRUNC() functions, or using ROUND( ) function.
How to add two decimal points to an integer in Oracle
To add two decimal points to an integer in Oracle , you can use the following methods:
Method 1: Use function TO_CHAR()
<code>TO_CHAR(整数, '999999999999999999.99')</code>rrree
Method 2: Use function LPAD()
and SUBSTR()
<code>SELECT TO_CHAR(123456789, '999999999999999999.99') FROM dual;</code>
<code>LPAD(整数, 整数长度 + 2, '0') || '.' || SUBSTR(整数, -2)</code>
Method 3: Use the functions TO_NUMBER()
and TRUNC()
<code>SELECT LPAD(123456789, 11 + 2, '0') || '.' || SUBSTR(123456789, -2) FROM dual;</code>
<code>TO_NUMBER(整数 || '00') / 100</code>
Method 4: Use the function ROUND()
<code>SELECT TO_NUMBER(123456789 || '00') / 100 FROM dual;</code>
<code>ROUND(整数, 2)</code>
The above methods can add two decimal points to the integer . Just choose the method that best suits your needs.
The above is the detailed content of How to express an integer with two decimal points in Oracle. For more information, please follow other related articles on the PHP Chinese website!