Help!!!

I'm not sure if I'm just incorrectly trying to commit every nth record, or if because I'm handling 4 million rows I keep getting the "ORA-01652: unable to extend temp segment..." error.

My goal is to move 2 large staging tables into one Fact Table. Any suggestions would be greatly appreciated!

Thanks,
tracy


DECLARE
CURSOR c1 IS SELECT
a.BUS_DATE_KEY bus_date_key ,a.BATCH_KEY batch_key ,
b.area_id area_id, sum(a.sales)
from stage_trade a, stage_month_earn b
where a.loan_join = b.loan_join
group by a.BUS_DATE_KEY ,a.BATCH_KEY ,b.AREA_id;
ctr NUMBER := 0;
BEGIN
FOR tg_rec IN c1 LOOP
ctr := ctr + 1;
IF ctr = 100 THEN
COMMIT;
INSERT into fct_trade_alloc (
BUS_DATE_KEY,BATCH_KEY,AREA_id,sales)
VALUES (
tg_rec.BUS_DATE_KEY,tg_rec.batch_key,
tg_rec.area_id, tg_rec.sales);
END IF;
END LOOP;
END;
/