DBA Data[Home] [Help]

MATERIALIZED VIEW: APPS.ISC_FS_006_MV

Source


select /* 12.0: bug#4526784 */
  f.time_id
, f.period_type_id
, decode( den.record_type, 'GROUP', den.parent_prg_id, f.parent_district_id ) parent_district_id
, decode( den.record_type, 'GROUP', den.record_type, f.record_type ) record_type
, decode( den.record_type, 'GROUP', den.prg_id, f.district_id ) district_id
, decode( den.record_type, 'GROUP', to_char(den.prg_id), to_char(f.district_id) || '.' || f.parent_district_id ) district_id_c
, sum(f.backlog_count) backlog_count
, sum(f.in_planning_count) in_planning_count
, sum(f.assigned_count) assigned_count
, sum(f.working_count) working_count
, sum(f.completed_count) completed_count
, sum(f.other_count) other_count
/* the following columns prefixed with mv_ exist solely to enable
   MV to be fast refreshable */
, grouping_id( f.time_id
             , f.period_type_id
             , decode( den.record_type, 'GROUP', den.parent_prg_id, f.parent_district_id )
             , decode( den.record_type, 'GROUP', den.record_type, f.record_type )
             , decode( den.record_type, 'GROUP', den.prg_id, f.district_id )
             , decode( den.record_type, 'GROUP', to_char(den.prg_id), to_char(f.district_id) || '.' || f.parent_district_id )
             )                 mv_grp_id
, count(*)                     mv_count
, count(f.backlog_count)       mv_backlog_count
, count(f.in_planning_count)   mv_in_planning_count
, count(f.assigned_count)      mv_assigned_count
, count(f.working_count)       mv_working_count
, count(f.completed_count)     mv_completed_count
, count(f.other_count)         mv_other_count
/* end of fast refreshable needed columns */
from
  isc_fs_005_mv f
, isc_fs_002_mv den
where
    f.grp_id = 7
and f.parent_district_id = den.rg_id
group by
  f.time_id
, f.period_type_id
, decode( den.record_type, 'GROUP', den.parent_prg_id, f.parent_district_id )
, decode( den.record_type, 'GROUP', den.record_type, f.record_type )
, decode( den.record_type, 'GROUP', den.prg_id, f.district_id )
, decode( den.record_type, 'GROUP', to_char(den.prg_id), to_char(f.district_id) || '.' || f.parent_district_id )