oracle report problem [message #153980] |
Thu, 05 January 2006 04:08 |
shatishr
Messages: 52 Registered: September 2005 Location: Shah Alam
|
Member |
|
|
hie all
im having a slight trouble here with my oracle report
PROCEDURE get_gap IS
v_reload_amount_ain number(12);
v_reload_amount_ppb number(12);
v_number_reload_ain number(12);
v_number_reload_ppb number(12);
BEGIN
v_reload_amount_ain := 0;
v_reload_amount_ppb := 0;
v_number_reload_ain := 0;
v_number_reload_ppb := 0;
:CP_1 := 0;
:CP_2 := 0;
:CP_3 := 0;
:CP_4 := 0;
select sum(reload_amount), count(reload_amount)
into v_reload_amount_ain, v_number_reload_ain
from trap_ra_k2_ain_balance
where week_no = :p_week;
select sum(reload_amount), count(reload_amount)
into v_reload_amount_ppb, v_number_reload_ppb
from trap_ra_k1_ppb_balance
where week_no = :p_week;
:CP_1 := v_reload_amount_ain - v_reload_amount_ppb;
:CP_2 := v_number_reload_ain - v_number_reload_ppb;
-- checking for 0 divisor
if (v_reload_amount_ppb) > 0 then
:CP_3 := abs(ROUND(:CP_1/(v_reload_amount_ain + v_reload_amount_ppb) *100,2));
else
:CP_3 := 0;
end if;
-- checking for 0 divisor
if (v_number_reload_ppb) > 0 then
:CP_4 := abs(ROUND(:CP_2/(v_number_reload_ain + v_number_reload_ppb) *100,2));
else
:CP_4 := 0;
end if;
END;
the problem here is CP1 is not returning any data in the report it is empty... i tried manually extracting this from db and the sum column is null since there is no data for that particular week for this table
select sum(reload_amount), count(reload_amount)
from trap_ra_k1_ppb_balance
where week_no = 53
what i want is, wherever there is null, it should replace to 0 in
v_reload_amount_ain number(12); and
v_reload_amount_ppb number(12);
any help ?
|
|
|
|