DBA Data[Home] [Help]

MATERIALIZED VIEW: APPS.OKI_SRM_012_MV

Source


Select /* 12.0: bug#4526784 */  'RESOURCE' UMARKER
       , authoring_org_id
       , RESOURCE_GROUP_ID                               rg_id
       , RESOURCE_GROUP_ID                               prg_id
       , NVL (resource_id, -1)                           resource_id
       , SERVICE_ITEM_ORG_ID
       , SERVICE_ITEM_CATEGORY_ID
       , GROUPING_ID ( RESOURCE_GROUP_ID
                      ,NVL (resource_id, -1)
		      ,authoring_org_id
                      ,SERVICE_ITEM_ORG_ID
                      ,SERVICE_ITEM_CATEGORY_ID
                      ,ent_qtr_id
                      ,ent_period_id
                      ,week_id
                      ,report_date_julian)                  GRP_ID
        ,decode( grouping_id(ent_qtr_id,ent_period_id,week_id,report_date_julian),
                0 ,report_date_julian,
                1 ,week_id,
                3 ,ent_period_id,
                7 ,ent_qtr_id) TIME_ID,
        ent_qtr_id ENT_QTR_ID,
        ent_period_id ENT_PERIOD_ID,
        week_id WEEK_ID,
        report_date_julian DAY_ID,
 	sum(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_f  END)	O_R_AMT_F,
	sum(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_g  END)	O_R_AMT_G,
	sum(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_sg  END)	O_R_AMT_SG,
	sum(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_a  END)	O_R_AMT_A,
	count(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_f  END)	C_O_R_AMT_F,
	count(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_g  END)	C_O_R_AMT_G,
	count(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_sg  END)	C_O_R_AMT_SG,
 	count(CASE WHEN nvl(f.date_cancelled,cle_creation_date+1) > cle_creation_date and nvl(f.date_signed,cle_creation_date+1) > cle_creation_date THEN price_negotiated_a  END)	C_O_R_AMT_A,
      count(*) AS c_total FROM   oki_Srm_001_mv f
                     ,FII.FII_TIME_DAY FII
WHERE   cle_creation_date = fii.report_date
AND     renewal_flag = 1
AND 1=1
GROUP BY resource_group_id,
        NVL (resource_id, -1),
        SERVICE_ITEM_ORG_ID,
        SERVICE_ITEM_CATEGORY_ID,
      	authoring_org_id,
        ROLLUP(ent_qtr_id, ent_period_id, week_id, report_date_julian)