Solved

Round function

Posted on 2008-10-09
2
389 Views
Last Modified: 2008-10-09
Hi,
I use round function in my query.But i want to take 2 decimal places like this number 100.1 ...



SELECT ROUND(salary,2) FROM emloyee

Result:

200.456 --> 200,46

200.1 --> 200.10 (i want to like this)

Open in new window

0
Comment
Question by:erenpasa
2 Comments
 
LVL 15

Accepted Solution

by:
Shaju Kumbalath earned 500 total points
Comment Utility

select to_char(salry,'999999999.00') from FROM emloyee;
0
 
LVL 2

Expert Comment

by:Monky42
Comment Utility
What you want cannot be accomplished by the round function, since it is essentially not a rounding issue but a number formatting issue (appending trailing zeros doesn't round the number).
If you want to do this formatting within SQL you will have to use the to_char/to_number function, as shajukg wrote.
A little turotial: http://www.techonthenet.com/oracle/functions/to_char.php
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now