Reputation: 21
When I run this query
SELECT TO_CHAR(0, 'Fm99.99') FROM DUAL;
I got 0.
as output in oracle 10g.
But when I run
SELECT TO_CHAR(0, '99.99') FROM DUAL;
this gives .00
as output.
Please explain what is the significance of FM
and how these two query behave differently
Upvotes: 1
Views: 3352
Reputation: 61
The fm (fill mode) operator removes extra spaces in months, days in the TO_CHAR function for the date.
Upvotes: 0
Reputation: 172458
fm signifies that you dont want the leading characters.
From the docs:
Fill mode. Oracle uses trailing blank characters and leading zeroes to fill format elements to a constant width. The width is equal to the display width of the largest element for the relevant format model
The FM modifier suppresses the above padding in the return value of the TO_CHAR function.
Upvotes: 1