Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Rounding "down" to the nearest multiple of 5

user12193344May 15 2013 — edited May 16 2013
Gurus,

I need some help rounding down to the nearest multiple of 5.

Example

before:

r-price = 100.00
s-price = 42.00

percent saved % = 60

after:

r-price = 100.00
s-price = 42.00

percent saved % = 55

So if the value is 51 - 54 round down to 50 and 56-59 round down 55.

How do I round down to the nearest multiple of 5 in my trigger?

create or replace
TRIGGER "SALE_CALCULATIONS" BEFORE
INSERT OR
UPDATE ON Prs FOR EACH Row

BEGIN

*:New.Prsvf19c := (ceil(((:new.prsprsc - :new.prsvf1c) / :new.prsprsc * 100) / 5) * 5) || '%';*

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2013
Added on May 15 2013
5 comments
2,203 views