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!

Oracle .5 rounding issue.

Rahm LFeb 8 2019 — edited Feb 9 2019

Oracle version 12.1.0.2.0 running on Linux Redhat 6

select round((25*(11/60)) + (65*(35/60)), 2), round((25*(11/60)) + (65*(35/60)))  from dual

Results in

 

ROUND((25*(11/60))+(65*(35/60)),2)ROUND((25*(11/60))+(65*(35/60)))
42.542

I would expect Oracle to round 42.5 to 43 but internally the calculation may be resolving to 42.49999. How do I fix the issue hopefully with an ora init parameter. I could potentially get the value into a number variable and round it but I would like to check with experts before I modify the code in multiple places.

NLS_CHARACTERSET                     AL32UTF8

NLS_NCHAR_CHARACTERSET      UTF8

NLS_NUMERIC_CHARACTERS       .,

NLS_LENGTH_SEMANTICS             BYTE

Thanks in advance,

Ram L.

Comments
Post Details
Added on Feb 8 2019
6 comments
951 views