702: k1.demand_class,
703: k2.end_date
704: from msc_demands_f k1,
705: (select trunc(v.month_end_date) end_date 706: from msc_calendar_dtl v, msc_plans mp 707: where mp.plan_id=p_plan_id
708: and v.month_end_date between mp.curr_start_date and mp.curr_cutoff_date
709: union all
710: select trunc(v.week_end_date) end_date