DBA Data[Home] [Help]

MATERIALIZED VIEW: APPS.ISC_DR_CHARGES_01_MV

Source


select
  /* 12.0: bug#4526784 */
  rof.repair_organization_id repair_organization_id
, nvl(items.vbh_category_id,-1) product_category_id
, rof.item_org_id item_org_id
, rof.customer_id customer_id
, rof.repair_type_id repair_type_id
, grouping_id( rof.repair_organization_id
             , nvl(items.vbh_category_id,-1)
             , rof.item_org_id
             , rof.customer_id
             , rof.repair_type_id
             , ent_qtr_id
             , ent_period_id
             , week_id
             , report_date_julian
             ) grp_id
, 31 - grouping_id( rof.item_org_id
                  , rof.customer_id
                  ,nvl(items.vbh_category_id,-1)
                  , rof.repair_organization_id
                  , rof.repair_type_id
                  ) aggregation_flag
, 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
, decode( grouping_id( ent_qtr_id
                     , ent_period_id
                     , week_id
                     , report_date_julian
                     )
        , 0, 1
        , 1, 16
        , 3, 32
        , 7, 64
        ) period_type_id
, cal.ent_qtr_id qtr_id
, cal.ent_period_id period_id
, cal.week_id week_id
, cal.report_date_julian day_id
, sum( charges.material_charges_g )      material_charges_g
, sum( charges.material_charges_sg )     material_charges_sg
, sum( charges.labor_charges_g )         labor_charges_g
, sum( charges.labor_charges_sg )        labor_charges_sg
, sum( charges.expense_charges_g )       expense_charges_g
, sum( charges.expense_charges_sg )      expense_charges_sg
, count( charges.material_charges_g )    mv_material_charges_g_cnt
, count( charges.material_charges_sg )   mv_material_charges_sg_cnt
, count( charges.labor_charges_g )       mv_labor_charges_g_cnt
, count( charges.labor_charges_sg )      mv_labor_charges_sg_cnt
, count( charges.expense_charges_g )     mv_expense_charges_g_cnt
, count( charges.expense_charges_sg )    mv_expense_charges_sg_cnt
, count (*)                             mv_cnt
from
  ISC.ISC_DR_REPAIR_ORDERS_F rof
, ISC.ISC_DR_CHARGES_F charges
, ENI.ENI_OLTP_ITEM_STAR items
, FII.FII_TIME_DAY cal
where
    rof.item_org_id = items.id
and rof.repair_line_id = charges.repair_line_id
and rof.dbi_date_closed = cal.report_date
group by
  rof.repair_organization_id
, rof.repair_type_id
, cal.ent_qtr_id
, rollup( rof.customer_id )
, rollup( nvl(items.vbh_category_id,-1)
        , rof.item_org_id
        )
, rollup( cal.ent_period_id
        , cal.week_id
        , cal.report_date_julian
        )