Reprinted from: 52778565
Encountered Oracle fetch format problem, here's a note
We usually make the data count, we want it to show the format we need, here's a simple way
To_char (data, ' fm999,999,999,999,990.00 ')
Example:
Select To_char (0.59/1.00*100, ' fm999,999,999,999,990.00 ') | | ' % ' from dual
The result is: 59%
The following is a detailed introduction (copy)
Select to_char (0.596,'fm999,999,999,990.00' from dual
The results of its implementation are as follows:
How to make it look like 0.60 decimal with 0, the answer is: Use the format as above
① Its 9 Rep: displays a number if there is a number, no space exists
② its 0 representation: If a number is present, the number is displayed, and 0 is displayed, that is, a placeholder.
③ its FM representative: Delete if it is caused by 9 space, then delete the
Specific differences can be seen
Selec Length (To_char (1.00,'999,999,999,999,999,999,999,990.00')), Length (to_ char (1.00,'fm999,999,999,999,999,999,999,990.00' from dual
The result is:
④ rounded: 0.596 became 0.60 did not know people noticed no. If you do not round, you will need to trunc under the following details:
The result is 0.59.
⑤ resolving the situation in listing 100,000,000
Select to_char (10000000000,'fm999,999,999,990.00' from dual
The above features apply to the fixed decimal point format. And if there's no decimal point?
⑥ resolving multiple points after an integer
Select to_char (10000000000,'fm999,999,999,990.99' from Dual
A similar scenario can occur: 10,000,000,000.
The solution for this class is to determine whether the word data is included first. (Point of case)
If a bit is InStr ()
otherwise direct To_cahr ()
This feature applies to: The page does not show 0 (a class of custom properties, Class A does not exist in the case of attribute B, through the Sqlmap query assignment is appropriate, under normal circumstances do not need to use), the front and rear table list does not display 0, front and rear list of 10,000,000,000 format.
Oracle function To_char (data, ' fm999,999,999,999,990.00 ') formatted data (GO)