[Home] [Help]
MATERIALIZED VIEW: APPS.OKI_SRM_032_MV
Source
Select /* 12.0: bug#4526784 */ 1 LUMARKER
, umarker
, authoring_org_id AUTHORING_ORG_ID
, rg_id RG_ID
, prg_id PRG_ID
, -999 RESOURCE_ID
, SERVICE_ITEM_CATEGORY_ID
, grouping_id(SERVICE_ITEM_CATEGORY_ID) PC_FLAG
, GROUPING_ID ( UMARKER
,rg_id
,prg_id
,f.authoring_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_002_MV f
,FII.FII_TIME_DAY FII
WHERE cle_creation_date = fii.report_date
AND renewal_flag =1
ANd 1=1
GROUP BY UMARKER
,rg_id
,prg_id
, rollup(SERVICE_ITEM_CATEGORY_ID)
,authoring_org_id
,ROLLUP(ent_qtr_id, ent_period_id, week_id, report_date_julian)
UNION ALL
SELECT 2 LUMARKER
, 'RESOURCE' UMARKER
, authoring_org_id
, RESOURCE_GROUP_ID rg_id
, RESOURCE_GROUP_ID prg_id
, NVL (resource_id, -1) resource_id
, SERVICE_ITEM_CATEGORY_ID
, grouping(SERVICE_ITEM_CATEGORY_ID) PC_FLAG
, GROUPING_ID ( RESOURCE_GROUP_ID
,NVL (resource_id, -1)
,authoring_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
GROUP BY resource_group_id,
NVL (resource_id, -1),
rollup(SERVICE_ITEM_CATEGORY_ID),
authoring_org_id,
ROLLUP(ent_qtr_id, ent_period_id, week_id, report_date_julian)