PDA

View Full Version : ROUND to nearest 0.05?


dbarchitech
01-12-2004, 11:31 AM
Hey all,

For the new year we're updating our price lists to reflect an increase
of 1.5%, but... we need to round the prices to the nearest 0.05. Is
there a way to do this in SQL*Plus?

Basically I want to emulate the MROUND function in Excel (eg.
MROUND((cell*1.015), 0.05).

Thoughts?

Sean Chang
01-12-2004, 12:40 PM
select round( price*1.015*20) /20 from your_table;

"dbarchitech" <noble_kid@mac.com> wrote in message
news:9d3dc423.0401121131.5266739f@posting.google.com... Hey all, For the new year we're updating our price lists to reflect an increase of 1.5%, but... we need to round the prices to the nearest 0.05. Is there a way to do this in SQL*Plus? Basically I want to emulate the MROUND function in Excel (eg. MROUND((cell*1.015), 0.05). Thoughts?




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Dave
01-12-2004, 02:40 PM
Sean Chang wrote:
select round( price*1.015*20) /20 from your_table; "dbarchitech" <noble_kid@mac.com> wrote in message news:9d3dc423.0401121131.5266739f@posting.google.com...Hey all,For the new year we're updating our price lists to reflect an increaseof 1.5%, but... we need to round the prices to the nearest 0.05. Isthere a way to do this in SQL*Plus?Basically I want to emulate the MROUND function in Excel (eg.MROUND((cell*1.015), 0.05).Thoughts?

Why not just ...

round(price*1.015, 2)

--
Richard Kuhler

Dave
01-12-2004, 02:45 PM
Richard Kuhler wrote:
Sean Chang wrote: select round( price*1.015*20) /20 from your_table; "dbarchitech" <noble_kid@mac.com> wrote in message news:9d3dc423.0401121131.5266739f@posting.google.com... Hey all, For the new year we're updating our price lists to reflect an increase of 1.5%, but... we need to round the prices to the nearest 0.05. Is there a way to do this in SQL*Plus? Basically I want to emulate the MROUND function in Excel (eg. MROUND((cell*1.015), 0.05). Thoughts? Why not just ... round(price*1.015, 2)

Doh! Nevermind, I read the post too fast. Obviously the solution I
posted is wrong. You will have to perform the round as Sean already
correctly pointed out.

--
Richard Kuhler


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service