Click here to Skip to main content
15,913,709 members
Please Sign up or sign in to vote.
1.14/5 (3 votes)
Hi Guys

I have issue of Round in Oracle / plsql;

I'm Developing System Transfer Different Currency;

What I have tried:

Example:
SELECT ROUND(14787 / 3.6697,2) FROM DUAL;
Result: 4029.48

Checking
SELECT ROUND(4029.48 * 3.6697,2) FROM DUAL
Result : 14786.98

So 14787 != 14786.98

so what is the best solution that i can solve this problem

thanks for you help
Posted
Updated 6-May-17 2:13am
Comments
Richard MacCutchan 1-May-17 3:34am    
The best choice is not to use float types for currency values. use integer or decimal types.
shreyal acharya 6-May-17 8:04am    
Use integer or decimal types values like

SELECT ROUND(14787 / 3) FROM DUAL;
SELECT ROUND(4929 * 3) FROM DUAL;

1 solution

Try out This

I Think This Is your solution.

SELECT ROUND(14787 / 3.6697,2) FROM DUAL;
SELECT ROUND( ROUND(4029.48* 3.6697),2) FROM DUAL;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900