Oracle converts numbers to formatted strings, oracle strings
Problem description
If oracle stores number (0.00) data, the value 0 indicates 2.1, the value 2.10 indicates 3.88, and the value 3.88 indicates,
If the corresponding information is taken directly from the database, it is shown:
0 2.1 3.88 if two decimal places are retained, it will change. If it needs to be consistent with the database:
Solution
To retain two valid decimal places:
SELECT TO_CHAR(3.2,'FM99999999999990D00') FROM DUAL
There is too much nonsense. The example is as follows:
Reference instance:
select to_char(a, '99D90'), to_char(a, '90D90'), to_char(a, 'FM90D99'), rtrim(to_char(a, 'FM90D99'), to_char(0, 'D'))from ( select 50 a from dual union all select 50.57 from dual union all select 5.57 from dual union all select 0.35 from dual union all select 0.4 from dual)order by a;TO_CHA TO_CHA TO_CHA RTRIM(------ ------ ------ ------ .35 0.35 0.35 0.35 .40 0.40 0.4 0.4 5.57 5.57 5.57 5.57 50.00 50.00 50. 50 50.57 50.57 50.57 50.57
Reference:
For details, click here.
Official documentation: oracle format doc
Example: example