Exact error....
ORA-12801: error signaled in parallel query server P006
ORA-00001: unique constraint (EIM.BI_INVN_ITEM_WEEK_FACT_IDX1) violated
Index...
create index BI_INVN_ITEM_WEEK_FACT_IDX1 on BI_INVN_ITEM_WEEK_FACT (TO_CHAR(CAL_DATE,'MONTH'));
Table is partition by Month
Here is the insert statement....value for nBeginDate_Dim_id will be passed
insert /*+ append_values parallel(b)*/ into bi_invn_item_week_fact b
select /*+ parallel(a) */
(select min(d.date_dim_id) from Bi_Date_Dim d where d.fiscal_year = a.fiscal_year and d.fiscal_quarter = a.fiscal_quarter
and d.fiscal_month = a.fiscal_month and d.fiscal_week = a.fiscal_week),
a.store_dim_id,
a.item_dim_id,
a.fiscal_year,
a.fiscal_quarter,
a.fiscal_month,
a.fiscal_week,
avg(a.qty) avg_qty,
avg(a.ext_cost) avg_ext_cost,
avg(a.ext_price) avg_ext_price,
avg(a.ext_cost / nullif(a.qty, 0)) avg_unit_cost,
avg(a.ext_price / nullif(a.qty, 0)) avg_unit_price,
min(a.cal_date)
from bi_invn_item_day_fact a
where a.date_dim_id >= nBeginDate_Dim_id
and a.store_dim_id in (select store_dim_id from bi_store_dim where sbs_no = pSbsNo)
group by a.fiscal_year, a.fiscal_quarter, a.fiscal_month, a.fiscal_week, a.store_dim_id, a.item_dim_id;