Rounding (rounding down):
Copy Code code as follows:
Select Floor (5.534) from dual;
Select Trunc (5.534) from dual;
The above two usages can be rounded down to the number 5.534, and the result is 5.
If you want to take the whole up and get a result of 6, you should use the Ceil
Copy Code code as follows:
Select Ceil (5.534) from dual;
Rounded:
Copy Code code as follows:
SELECT round (5.534) from dual;
SELECT round (5.534,0) from dual;
SELECT round (5.534,1) from dual;
SELECT round (5.534,2) from dual;
The results were 6, 6, 5.5, 5.53, respectively.
Keep n Decimal (not rounded):
Copy Code code as follows:
Select Trunc (5.534,0) from dual;
Select Trunc (5.534,1) from dual;
Select Trunc (5.534,2) from dual;
The result is 5,5.5,5.53, where a 0-digit decimal is the equivalent of a direct rounding.
Number formatting:
Copy Code code as follows:
Select To_char (12345.123, ' 99999999.9999 ') from dual;
Result is 12345.123
Copy Code code as follows:
Select To_char (12345.123, ' 99999999.9900 ') from dual;
After the decimal, the third fourth is insufficient to fill 0, the result is 12345.1230
Copy Code code as follows:
Select To_char (0.123, ' 99999999.9900 ') from dual;
Select To_char (0.123, ' 99999990.9900 ') from dual;
The results were. 123, 0.123
The above is the cloud Habitat Community Small series for everyone to organize the Oracle in the number of commonly used operations, the need for small partners can refer to.