DBA Data[Home] [Help]

MATERIALIZED VIEW: APPS.ISC_SAM_007_MV

Source


select 	0								UMARKER,  	'SALES REP'							GRP_MARKER,  	fact.customer_id						CUSTOMER_ID,  	cc.class_code							CLASS_CODE,  	sc.resource_id							RESOURCE_ID,  	sc.sales_grp_id							SALES_GRP_ID,  	sc.sales_grp_id							PARENT_GRP_ID,  	decode(grouping_id(cc.class_code,   		     fact.customer_id),0,0,1,1,3,3)		AGG_LEVEL,  	grouping_id( cc.class_code,  		     fact.customer_id,  		     sc.resource_id,  		     sc.sales_grp_id,  		     cal.ent_year_id,  		     cal.ent_qtr_id,  		     cal.ent_period_id,  		     cal.week_id,  		     cal.report_date_julian)				GRP_ID,  	cal.ent_year_id,  	cal.ent_qtr_id,  	cal.ent_period_id,  	cal.week_id,  	cal.report_date_julian,  	decode(grouping_id(cal.ent_year_id, cal.ent_qtr_id, cal.ent_period_id, cal.week_id, cal.report_date_julian),  		30, cal.report_date_julian,  		29, cal.week_id,  		27, cal.ent_period_id,  		23, cal.ent_qtr_id,  		15, cal.ent_year_id)					TIME_ID,          sum(fact.fulfilled_amt_g*sc.sales_credit_percent/100)      fulfill_amt_g,          sum(fact.fulfilled_amt_g1*sc.sales_credit_percent/100)      fulfill_amt_g1,          count(fact.fulfilled_amt_g*sc.sales_credit_percent/100)      c_fulfill_amt_g,          count(fact.fulfilled_amt_g1*sc.sales_credit_percent/100)      c_fulfill_amt_g1,          count(*)  c_total  from	ISC.ISC_DBI_BSA_ORDER_LINES_F		fact,        ISC.ISC_SALES_CREDITS_F      sc,  	FII.FII_PARTY_MKT_CLASS			cc,  	FII.FII_TIME_DAY	cal  where	fact.time_fulfilled_date_id = cal.report_date  and	fact.customer_id = cc.party_id  and   fact.blanket_line_number is not null  and   fact.order_line_id = sc.line_id  and fact.transaction_phase_code = 'F'  and fact.commit_prorated_amt_g is not null  and fact.blanket_line_id is not null  and nvl(fact.time_termination_date_id, fact.time_activation_date_id + 1) >= fact.time_activation_date_id  group by sc.resource_id, sc.sales_grp_id,          rollup(cc.class_code, fact.customer_id),  	grouping sets(cal.ent_year_id, cal.ent_qtr_id, cal.ent_period_id, cal.week_id, cal.report_date_julian)  union all  select 	1								UMARKER,  	grp.umarker							GRP_MARKER,  	fact.customer_id						CUSTOMER_ID,  	cc.class_code							CLASS_CODE,  	null								RESOURCE_ID,  	grp.prg_id							SALES_GRP_ID,  	grp.parent_prg_id						PARENT_GRP_ID,  	decode(grouping_id( cc.class_code,   		     fact.customer_id),0,0,1,1,3,3)		AGG_LEVEL,  	grouping_id( cc.class_code,  		     fact.customer_id,  		     grp.umarker,  		     grp.prg_id,  		     grp.parent_prg_id,  		     cal.ent_year_id,  		     cal.ent_qtr_id,  		     cal.ent_period_id,  		     cal.week_id,  		     cal.report_date_julian)				GRP_ID,  	cal.ent_year_id,  	cal.ent_qtr_id,  	cal.ent_period_id,  	cal.week_id,  	cal.report_date_julian,  	decode(grouping_id(cal.ent_year_id, cal.ent_qtr_id, cal.ent_period_id, cal.week_id, cal.report_date_julian),  		30, cal.report_date_julian,  		29, cal.week_id,  		27, cal.ent_period_id,  		23, cal.ent_qtr_id,  		15, cal.ent_year_id)					TIME_ID,          sum(fact.fulfilled_amt_g*sc.sales_credit_percent/100)      fulfill_amt_g,          sum(fact.fulfilled_amt_g1*sc.sales_credit_percent/100)      fulfill_amt_g1,          count(fact.fulfilled_amt_g*sc.sales_credit_percent/100)      c_fulfill_amt_g,          count(fact.fulfilled_amt_g1*sc.sales_credit_percent/100)      c_fulfill_amt_g1,          count(*)  c_total  from	ISC.ISC_DBI_BSA_ORDER_LINES_F		fact,        ISC.ISC_SALES_CREDITS_F      sc,  	FII.FII_PARTY_MKT_CLASS			cc,  	oki_rs_group_mv				grp,  	FII.FII_TIME_DAY	cal  where	fact.time_fulfilled_date_id = cal.report_date  and	fact.customer_id = cc.party_id  and	sc.sales_grp_id = grp.rg_id  and   fact.blanket_line_number is not null  and   fact.order_line_id = sc.line_id  and fact.transaction_phase_code = 'F'  and fact.commit_prorated_amt_g is not null  and fact.blanket_line_id is not null  and nvl(fact.time_termination_date_id, fact.time_activation_date_id + 1) >= fact.time_activation_date_id  group by grp.umarker, grp.prg_id, grp.parent_prg_id,          rollup(cc.class_code, fact.customer_id),  	grouping sets(cal.ent_year_id, cal.ent_qtr_id, cal.ent_period_id, cal.week_id, cal.report_date_julian)