soumyadeep deb
soumyadeep deb

Reputation: 21

Significance of "Fm"

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

Answers (2)

Ihor Antonov
Ihor Antonov

Reputation: 61

The fm (fill mode) operator removes extra spaces in months, days in the TO_CHAR function for the date.

Upvotes: 0

Rahul Tripathi
Rahul Tripathi

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

Related Questions