Problem with Sum and Decimals
430762Feb 29 2008 — edited Mar 1 2008Hi,
Can any one please explain me what is happening here?
declare
l_pct_total number:
begin
select nvl(sum(pct_total),0)
into l_pct_total
from my_table
where id = '1234';
if l_pct_total <> 100
then
dbms_output.put_line('l_pct_total is not equal to 100');
else
dbms_output.put_line('l_pct_total is -->' || l_pct_total);
end if;
end;
the result i am getting is 'l_pct_total is not equal to 100'
Table data is:
ID pct_total
1234 1.12946407
1243 1.12360039
1234 1.12360039
1234 0.85603784
1234 0.98874069
1234 94.7785566
Now if i do
select floor(nvl(sum(pct_total),0))
--into l_pct_total
from my_table
where id = '1234';
FLOOR((NVL(SUM(PCT_TOTAL
------------------------------
99
I am wondering what is happening here?
Thanks and Regards
Amit