or
to_char(your_number,'0.99'
Main Topics
Browse All TopicsHey guys! I have a problem with my code. I need to convert the numeric result of a subquery to a string. However, since the numbers have n decimal places, I need to round the number to 2 decimals before the number to string conversion kicks in.
Can you tell me how it is possible? I got the following code below!
Thanks a lot! I appreciate your help!!!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Basically ,3 in last line should be inside round.
and (p.int_be_main = :P2014_be))),3) should be and (p.int_be_main = :P2014_be)),3))
Here is my code which is working fine
select to_char(round((count (t.one) *100)/
decode(( select count (t.one) as Anzahl
from
one t,
two p,
three e
where
(p.two = 2)
and (t.one = p.two)
and (t.one = e.three)
),0,1)
,3)) as Percent
from one t
group by one
Hey guys! Thanks for your input! I should have been more precise I guess. The problem is not to round to 2 decimals (I posted round(number,3)) instead of 2. Instead, the rounding and conversion fails and I receive an error message. Thus, the question is in which order they should be applied or how to overcome the error message and get this query to work.
Thanks guys! I got it to work! The 3 that specifies the round function's decimal places was indeed placed at the wrong place. Like virdi_ds posted it should have been between both bracket sets to be assigned to the round function. I simply got lost with all those brackets! Especially seeing that it is just a subquery.
Good job! Thank you both!
Business Accounts
Answer for Membership
by: sdstuberPosted on 2009-11-05 at 08:35:32ID: 25751196
to_char(round(your_number, 2))