Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ceil or round in oracle

Posted on 2013-05-23
9
Medium Priority
?
596 Views
Last Modified: 2013-05-23
select (10.5*15.01) from dual


157.605

I tried using ceil and also round

I get the value 158.

I need help in decimals. 605 has to be 61 -- 157.61
0
Comment
Question by:anumoses
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 39190625
select round(10.5*15.01,2) from dual


select ceil(100*10.5*15.01)/100 from dual
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39190638
select
  round(x,0)
, round(x,3)
, ceil(x)
, floor(x)
from (
      select (10.5*15.01) as x from dual
     )

Open in new window

ROUND(X,0)      ROUND(X,3)      CEIL(X)      FLOOR(X)
158                 157.605         158         157

not sure what you are asking for
0
 
LVL 6

Author Comment

by:anumoses
ID: 39190666
select (ceil(100*70*15.01)/100) from dual
   
   select round(70*15.01,2) from dual

1050.7

Is there a ways to have 1050.70?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 74

Accepted Solution

by:
sdstuber earned 1000 total points
ID: 39190676
if you want formatting, convert it to a string

select to_char((ceil(100*70*15.01)/100),'fm9999.00') from dual
   
   select to_char(round(70*15.01,2),'fm9999.00') from dual
0
 
LVL 14

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 39190757
... or just do the formatting "later" within your frontend...

But the point is: what exactly are you asking for / what do you want to do ?!
0
 
LVL 6

Author Comment

by:anumoses
ID: 39190761
I am asking for formatting the numbers that I get as results. rounding the decimals to 2 decimals.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 39190771
formatted rounded to 2 decimals....


 select to_char(round(70*15.01,2),'fm9999.00') from dual
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39190844
http://www.techonthenet.com/oracle/functions/
http://www.techonthenet.com/oracle/functions/ceil.php
http://www.techonthenet.com/oracle/functions/floor.php
http://www.techonthenet.com/oracle/functions/round_nbr.php

with round() YOU specify the number of decimals points as the second parameter in that function

for "display" you use to_char, THEN there you may also specify the number of decimal points to show for presentation by the "format mask" (which is the second parameter to that function).
http://www.techonthenet.com/oracle/functions/to_char.php

I'd suggest you get familiar with these functions
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39191092
thanks
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

610 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