DBA Data[Home] [Help]

MATERIALIZED VIEW: APPS.ENI_DBI_AR_BASE_MV

Source


SELECT /* 12.0: bug#4526784 */
        NVL(fday.report_date_julian,
                NVL(fday.week_id,
                        NVL(fday.ent_period_id,
                                NVL(fday.ent_qtr_id, fday.ent_year_id)))) TIME_ID,
        DECODE(fday.report_date_julian, NULL,
                DECODE(fday.week_id, NULL,
                        DECODE(fday.ent_period_id, NULL,
                                DECODE(fday.ent_qtr_id,NULL, 128, 64), 32),16), 1) PERIOD_TYPE_ID,
        fday.report_date_julian,
        fday.ent_qtr_id,
        fday.ent_period_id,
        fday.week_id,
        fday.ent_year_id,
        eois.vbh_category_id AS product_category_id,
        b.inventory_item_id,
        b.organization_id,
        count(*),
        sum(b.prim_amount_g)  REV_PRIM_ACTUAL_G,
        count(b.prim_amount_g) COUNT_REV_PRIM_ACTUAL_G,
        sum(b.sec_amount_g)  REV_SEC_ACTUAL_G,
        count(b.sec_amount_g) COUNT_REV_SEC_ACTUAL_G,
        grouping_id(
                eois.vbh_category_id,
                b.inventory_item_id,
                b.organization_id,
                fday.ent_year_id,
                fday.ent_qtr_id,
                fday.ent_period_id,
                fday.week_id,
                fday.report_date_julian) gid
FROM
        FII.FII_AR_REVENUE_B b,
	ENI.ENI_OLTP_ITEM_STAR eois,
        FII.FII_TIME_DAY fday
WHERE
 b.inventory_item_id = eois.inventory_item_id and
 b.ITEM_ORGANIZATION_ID = eois.organization_id and
 b.gl_date_id = fday.report_date_julian
and b.fin_cat_type_code = 'R'
GROUP BY
        eois.vbh_category_id,
        b.inventory_item_id,
        b.organization_id,
        grouping sets (
                fday.ent_year_id,
                fday.ent_qtr_id,
                fday.ent_period_id,
                fday.week_id,
                fday.report_date_julian)