Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

trunc percentage two decimal places

798631Jan 7 2011 — edited Jan 7 2011
I have a report that has the option of dispalying pdf or excel. I have the pdf version working fine but i am having a little trouble on the excel version. I have a grand total and department total. Basically I need help formating two decimal places. Both dept_total and grand_total are numbers that both display. I have another column that displays what percent of the total is from each dept.It currently returns a number such as 10.23383547957459973 which i need to display as 10.23 How can i incorporate the trunc function into this code?

...to_char((dept_total/grand_total) *100)

The query looks similar to this.
select
to_char(a._grand_total)
,to_char(a.dept_total)
,to_char((dept_total/grand_total) *100)
from(
select sum(xxxx) grand_total,
sum(xxxx) dept_total
from table)a
This post has been answered by Solomon Yakobson on Jan 7 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 4 2011
Added on Jan 7 2011
3 comments
8,061 views