我做了一个将好几个视图的数据写入一个表中的触发器,但是最后写入到表里的值会有空值,这样会影响我在做报表时候的计算,我想将空值赋值为0,我写了个触发器,可是还是不行,帮忙看看
CREATE OR REPLACE TRIGGER tri_day_report
after   update  ON day_report_time
FOR EACH ROW
DECLARE
systime varchar2(10);
no_shift varchar2(2);
no_shift_code number(1);
before_systime varchar2(10);
begin
delete from day_report;
delete from temp_shift;
systime:=:new.report_time;
insert into day_report(product_time,shift,shift_grade,shift_code,furnace_no,furnace_no_total,furnace_weight,furnace_weight_total,
                       qualified_product,qualified_product_total,waste_product,waste_product_total,rolling_waste,rolling_waste_total,electric,coal,rolling_time)
select v_furnace_shift_rolling_total.product_time,v_furnace_shift_rolling_total.shift,v_furnace_shift_rolling_total.shift_grade,v_furnace_shift_rolling_total.shift_code,
       case when v_furnace_shift_rolling_total.rolling='' then 0 else v_furnace_shift_rolling_total.rolling end,
       case when v_furnace_shift_rolling_total.rolling_total='' then 0 else v_furnace_shift_rolling_total.rolling_total end,
       case when weight='' then 0 else weight end,
       case when weight_total='' then 0 else weight_total end,
       case when qualified_product='' then 0 else qualified_product end,
       case when qualified_product_total='' then 0 else qualified_product_total end,
       case when waste_product='' then 0 else waste_product end,
       case when waste_product_total='' then 0 else waste_product_total end,
       case when v_rolling_waste_total.rolling='' then 0 else v_rolling_waste_total.rolling end,
       case when v_rolling_waste_total.rolling_total='' then 0 else v_rolling_waste_total.rolling_total end,
       case when v_power_depletion.electric='' then 0 else v_power_depletion.electric end,
       case when v_power_depletion.coal='' then 0 else v_power_depletion.coal end,
       case when v_rolling_time.rolling_time='' then 0 else v_rolling_time.rolling_time end
from V_furnace_shift_rolling_total left join  v_furnace_shift_weight_total on V_furnace_shift_rolling_total.shift=v_furnace_shift_weight_total.shift and v_furnace_shift_weight_total.product_time=systime
     left join V_qualified_product_total on V_qualified_product_total.shift=V_furnace_shift_rolling_total.shift_code and V_qualified_product_total.product_time=systime
     left join v_check_waste_total on v_check_waste_total.shift=V_furnace_shift_rolling_total.shift_code and v_check_waste_total.product_time=systime
     left join v_rolling_waste_total on v_rolling_waste_total.shift=V_furnace_shift_rolling_total.shift_code and v_rolling_waste_total.product_time=systime
     left join v_power_depletion on v_power_depletion.shift=V_furnace_shift_rolling_total.shift and v_power_depletion.product_time=systime
     left join v_rolling_time on v_rolling_time.shift=V_furnace_shift_rolling_total.shift_code and v_rolling_time.product_time=systime
where V_furnace_shift_rolling_total.product_time=systime ;
end ;