Oracle SQL output change number to 99.99 format

k3vsmith
k3vsmith used Ask the Experts™
on
I have a field that Im selecting called percentcomplete.
Select PHYSICALPERCENTCOMPLETE
From Tablex

Where currently the output looks like:
87.765342
65.546323773
2
0
100
38.4

I want to change my sql select so that it displays only 2 numbers past the decimal:

87.76
65.54
2.00
0.00
100.00
38.40

How do I change this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Select to_char(PHYSICALPERCENTCOMPLETE,'999.99')
 From Tablex
Most Valuable Expert 2011
Top Expert 2012

Commented:
select to_char(PHYSICALPERCENTCOMPLETE,'999.00') from tablex
Most Valuable Expert 2012
Distinguished Expert 2018
Commented:
Small correction for the '0':

Select to_char(PHYSICALPERCENTCOMPLETE,'990.99')
  From Tablex
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Most Valuable Expert 2011
Top Expert 2012
Commented:
all of the posts above will embed spaces the left pad the value for a sign and 3 digits

if you don't want the leading spaces, but only the actual digits then include the "fm"


select to_char(PHYSICALPERCENTCOMPLETE,'fm990.00')  from tablex


also note,  using 00 after the decimal point is important instead of 99  when using fm

Author

Commented:
This works but anything that was a 0 is now outputting as .00
This isnt a huge problem but anyway to get that to also output as 0.00?

Author

Commented:
Ah, thanks!

Author

Commented:
Thanks guys!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial