1

Im using the following code to convert a number(38,2) to the format "XXX.XXX.XXX,XX":

TO_CHAR(number, '999G999G999G999G999G999G999D99')

Although, when the number is 0 or 0.XX the 0 is eaten up :

Input: 0
Result: ",00"
Expected Result: "0,00"

Input: 0.23
Result: ",23"
Expected Result: "0,23"

Why does this happen, is there a way of solving this without manipulating the result string ?

Enoque Duarte
  • 689
  • 4
  • 22

1 Answers1

3

Use 0 instead of 9

TO_CHAR(0.00, '999G999G999G999G999G999G990D99')

0 ensures that if there is no digit in that place it'll display 0.

Gurwinder Singh
  • 38,557
  • 6
  • 51
  • 76