Damian
Damian

Reputation: 211

Oracle APEX - no leading zero

I have an app build in Oracle APEX 18.2. Every number field in app have missing leading zero. For example when the number is 0.5, APEX displays it as .5. The problem occurs also in SQL Workshop. In SQL Developer numbers with leading zeros are formatted well, so I think this is problem with Oracle APEX, not with Oracle DB. Is there any global setting for number formatting in APEX?

Upvotes: 2

Views: 2710

Answers (4)

Paulo Künzel
Paulo Künzel

Reputation: 849

I'll assume you have a Classic or Interactive Report, in such case:

  • Go to page designer and select the column
  • Go to the format mask option
  • Select the numeric format you wish to have.
  • You'll probably get something like 999G999G999G999G990D00
  • if it has a 9D00 at the end, change the 9 to a 0

Upvotes: 1

Kris de Rycke
Kris de Rycke

Reputation: 11

I had the same issue recently. i fixed it using to_char(xxx,'FM999G990D00')

SELECT mont.period_name AS PERIOD
     , to_char(ivo.total_overtime,'FM999G990D00')
     , to_char(emho.ACTUAL_TRANSFERRED_HOURS,'FM999G990D00')
     , to_char(emho.actual_recup_days,'FM999G990D00')
FROM .....

worked like a charm

Upvotes: 1

Jordan R. RM
Jordan R. RM

Reputation: 11

I had an issue adding zeros to numbers, but it was fixed using Function with Oracle Developer

select LPAD((max(ID))+1, 6, '0') from Yourtable

and call it as a function.

Probably you could use PL/SQL expressions to fix it

Upvotes: 1

Littlefoot
Littlefoot

Reputation: 143023

As far as I can tell, there's no such a global setting, which means that you'd have to apply some format mask either

  • directly (in SELECT statement, within the TO_CHAR function call), or
  • in column's (item's) property

Format mask you might consider is FM999G990D00 as

  • FM will remove leading spaces and superfluous trailing zeros
  • instead of using explicit , and . grouping & decimal characters, use G and D instead

Upvotes: 1

Related Questions