anumoses
asked on
ceil or round in oracle
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
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
select
round(x,0)
, round(x,3)
, ceil(x)
, floor(x)
from (
select (10.5*15.01) as x from dual
)
ROUND(X,0) ROUND(X,3) CEIL(X) FLOOR(X)158 157.605 158 157
not sure what you are asking for
ASKER
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?
select round(70*15.01,2) from dual
1050.7
Is there a ways to have 1050.70?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
... 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 ?!
But the point is: what exactly are you asking for / what do you want to do ?!
ASKER
I am asking for formatting the numbers that I get as results. rounding the decimals to 2 decimals.
formatted rounded to 2 decimals....
select to_char(round(70*15.01,2), 'fm9999.00 ') from dual
select to_char(round(70*15.01,2),
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
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
ASKER
thanks
select ceil(100*10.5*15.01)/100 from dual