222: begin
223:
224:
225: select nvl(dmd_priority_scenario_id,-999) into l_dmd_prty_scen_id
226: from msd_dp_scenarios
227: where demand_plan_id = p_demand_plan_id
228: and scenario_id = p_scenario_id;
229:
230: if (l_dmd_prty_scen_id = -999) then
279: */
280: CURSOR c_get_scenario_ids
281: IS
282: SELECT scenario_id
283: FROM msd_dp_scenarios a
284: WHERE
285: a.demand_plan_id = p_demand_plan_id
286: AND NOT EXISTS (SELECT 1
287: FROM msd_dp_scenarios b
283: FROM msd_dp_scenarios a
284: WHERE
285: a.demand_plan_id = p_demand_plan_id
286: AND NOT EXISTS (SELECT 1
287: FROM msd_dp_scenarios b
288: WHERE
289: b.demand_plan_id = a.demand_plan_id
290: AND b.dmd_priority_scenario_id = a.scenario_id);
291:
293: */
294: CURSOR c_get_dmd_priority_scn_ids
295: IS
296: SELECT dmd_priority_scenario_id
297: FROM msd_dp_scenarios
298: WHERE
299: demand_plan_id = p_demand_plan_id
300: AND dmd_priority_scenario_id is not null;
301:
456: 'null, ' ||
457: 'mdse.demand_class), ' ||
458: 'mdse.demand_class), ' ||
459: '''-100'') DEMAND_CLASS ' ||
460: 'from msd_dp_scenarios mds, ' ||
461: 'msd_dp_scenario_entries mdse ' ||
462: 'WHERE mds.demand_plan_id = ' || p_demand_plan_id || ' ' ||
463: 'AND mds.scenario_id ' || x_dmd_pri_scenario_id_list ||
464: 'AND mds.demand_plan_id = mdse.demand_plan_id ' ||