[Home] [Help]
MATERIALIZED VIEW: APPS.ISC_FS_014_MV
Source
select /* 12.0: bug#4526784 */
decode( grouping_id( c.ent_year_id
, c.ent_qtr_id
, c.ent_period_id
, c.week_id
, c.report_date_julian ), 0, c.report_date_julian
, 1, c.week_id
, 3, c.ent_period_id
, 7, c.ent_qtr_id
, 15, c.ent_year_id ) time_id
, decode( grouping_id( c.ent_year_id
, c.ent_qtr_id
, c.ent_period_id
, c.week_id
, c.report_date_julian ), 0, 1
, 1, 16
, 3, 32
, 7, 64
, 15, 128 ) period_type_id
, decode( den.record_type, 'GROUP', den.parent_prg_id, f.district_id ) parent_district_id
-- R12 resource type impact
, decode( den.record_type, 'GROUP', den.record_type, f.owner_type ) record_type
, decode( den.record_type, 'GROUP', den.prg_id, f.owner_id ) district_id
, decode( den.record_type, 'GROUP', to_char(den.prg_id), to_char(f.owner_id) || '.' || f.district_id ) district_id_c
, sum( f.capacity_hours ) planned_hrs
, grouping_id( c.ent_year_id
, c.ent_qtr_id
, c.ent_period_id
, c.week_id
, c.report_date_julian
-- R12 resource type impact
, decode( den.record_type, 'GROUP', den.record_type, f.owner_type )
, decode( den.record_type, 'GROUP', den.parent_prg_id, f.district_id )
, decode( den.record_type, 'GROUP', den.prg_id, f.owner_id )
, decode( den.record_type, 'GROUP', to_char(den.prg_id), to_char(f.owner_id) || '.' || f.district_id )
) mv_grp_id
, c.report_date_julian mv_day_id
, c.week_id mv_week_id
, c.ent_period_id mv_period_id
, c.ent_qtr_id mv_ent_qtr_id
, c.ent_year_id mv_ent_year_id
, count(*) mv_count
, count( f.capacity_hours ) mv_planned_hrs
from
ISC.ISC_FS_CAPACITY_F f
, FII.FII_TIME_DAY c
, isc_fs_002_mv den
where
f.capacity_date = c.report_date
and f.district_id = den.rg_id
and f.deleted_flag = 'N'
and f.blocked_trip_flag = 'N'
group by
c.ent_year_id
, rollup( c.ent_qtr_id
, c.ent_period_id
, c.week_id
, c.report_date_julian )
-- R12 resource type impact
, decode( den.record_type, 'GROUP', den.record_type, f.owner_type )
, decode( den.record_type, 'GROUP', den.parent_prg_id,f.district_id )
, decode( den.record_type, 'GROUP', den.prg_id,f.owner_id )
, decode( den.record_type, 'GROUP', to_char(den.prg_id), to_char(f.owner_id) || '.' || f.district_id )