175: WHERE demand_plan_id = p_demand_plan_id
176: AND dp_dimension_code <> 'TIM'
177: AND NOT EXISTS
178: (SELECT hierarchy_id
179: FROM msd_dp_hierarchies_v dh
180: WHERE pd.demand_plan_id = dh.demand_plan_id
181: AND pd.dp_dimension_code = dh.dp_dimension_code);
182: --
183: -- find dimensions that don't have hierarchies or have invalid hierarchies
188: WHERE demand_plan_id = p_demand_plan_id
189: AND dp_dimension_code <> 'TIM'
190: AND NOT EXISTS
191: (select hierarchy_id
192: from msd_dp_hierarchies_v dh
193: where pd.demand_plan_id = dh.demand_plan_id
194: and pd.dimension_code = dh.owning_dimension_code);
195:
196:
211: select
212: dh.hierarchy_name,
213: hi.dimension_code
214: from
215: msd_dp_hierarchies_v dh,
216: msd_hierarchies hi
217: where
218: dh.hierarchy_id = hi.hierarchy_id and
219: dh.demand_plan_id = p_demand_plan_id and
224: CURSOR get_dim_no_lvl( p_demand_plan_id NUMBER) IS
225: SELECT DISTINCT dp_dimension_code,
226: hl. hierarchy_name,
227: level_name
228: FROM msd_dp_hierarchies_v dh,
229: msd_hierarchy_levels_v hl
230: WHERE demand_plan_id = p_demand_plan_id
231: AND dp_dimension_code <> 'TIM'
232: AND dh.hierarchy_id = hl.hierarchy_id
358: AND scen.enable_flag = 'Y'
359: AND a.level_id not in
360: ( select b.level_id
361: from msd_hierarchy_levels b,
362: msd_dp_hierarchies_v c
363: where b.hierarchy_id = c.hierarchy_id
364: and c.demand_plan_id = p_demand_plan_id
365: union
366: select b.parent_level_id
364: and c.demand_plan_id = p_demand_plan_id
365: union
366: select b.parent_level_id
367: from msd_hierarchy_levels b,
368: msd_dp_hierarchies_v c
369: where b.hierarchy_id = c.hierarchy_id
370: and c.demand_plan_id = p_demand_plan_id
371: );
372:
442: AND mcd.name = mdp.parameter_type
443: AND nvl(mcdd.collect_level_id, 0) not in
444: ( select b.level_id
445: from msd_hierarchy_levels b,
446: msd_dp_hierarchies_v c
447: where b.hierarchy_id = c.hierarchy_id
448: and c.demand_plan_id = p_demand_plan_id
449: and mcdd.dimension_code <> 'TIM'
450: union
449: and mcdd.dimension_code <> 'TIM'
450: union
451: select b.parent_level_id
452: from msd_hierarchy_levels b,
453: msd_dp_hierarchies_v c
454: where b.hierarchy_id = c.hierarchy_id
455: and c.demand_plan_id = p_demand_plan_id
456: and mcdd.dimension_code <> 'TIM'
457: );
459: -- Determine whether level is contain in Dp Hierarchies.
460: CURSOR get_inv_hier_lvl_prms (p_demand_plan_id IN NUMBER, p_lvl_id in NUMBER) is
461: select 1
462: from msd_hierarchy_levels b,
463: msd_dp_hierarchies_v c
464: where b.hierarchy_id = c.hierarchy_id
465: and c.demand_plan_id = p_demand_plan_id
466: and (b.level_id = p_lvl_id
467: or