Oracle – Understanding TO_CHAR Format ‘FM99990.90’

oracle

I have this number format and not able to find examples of how it will look. It is not listed on Oracle website. This below SQL is what I have and not sure what the result will look like since I don't have access to Oracle SQL at the moment to be able to run and see the result.

to_char(deductionAmount, 'FM99990.90')

Does anyone know? Deduction amount is in this format most likely: xx.xx

Best Answer

Of course it is listed/documented.

Format Model Modifiers

FM

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:

Numeric elements are padded with leading zeros to the width of the maximum value allowed for the element. For example, the YYYY element is padded to four digits (the length of '9999'), HH24 to two digits (the length of '23'), and DDD to three digits (the length of '366').

...

Example:

SQL> select to_char(1.5, 'FM99990.90') from dual;

TO_CHAR(1
---------
1.50

SQL> select to_char(1.5, '99990.90') from dual;

TO_CHAR(1
---------
     1.50

SQL>