179: WHERE demand_plan_id = p_demand_plan_id
180: AND dp_dimension_code <> 'TIM'
181: AND NOT EXISTS
182: (SELECT hierarchy_id
183: FROM msd_dp_hierarchies_v dh
184: WHERE pd.demand_plan_id = dh.demand_plan_id
185: AND pd.dp_dimension_code = dh.dp_dimension_code);
186: --
187: -- find dimensions that don't have hierarchies or have invalid hierarchies
192: WHERE demand_plan_id = p_demand_plan_id
193: AND dp_dimension_code <> 'TIM'
194: AND NOT EXISTS
195: (select hierarchy_id
196: from msd_dp_hierarchies_v dh
197: where pd.demand_plan_id = dh.demand_plan_id
198: and pd.dimension_code = dh.owning_dimension_code);
199:
200:
215: select
216: dh.hierarchy_name,
217: hi.dimension_code
218: from
219: msd_dp_hierarchies_v dh,
220: msd_hierarchies hi
221: where
222: dh.hierarchy_id = hi.hierarchy_id and
223: dh.demand_plan_id = p_demand_plan_id and
228: CURSOR get_dim_no_lvl( p_demand_plan_id NUMBER) IS
229: SELECT DISTINCT dp_dimension_code,
230: hl. hierarchy_name,
231: level_name
232: FROM msd_dp_hierarchies_v dh,
233: msd_hierarchy_levels_v hl
234: WHERE demand_plan_id = p_demand_plan_id
235: AND dp_dimension_code <> 'TIM'
236: AND dh.hierarchy_id = hl.hierarchy_id
362: AND scen.enable_flag = 'Y'
363: AND a.level_id not in
364: ( select b.level_id
365: from msd_hierarchy_levels b,
366: msd_dp_hierarchies_v c
367: where b.hierarchy_id = c.hierarchy_id
368: and c.demand_plan_id = p_demand_plan_id
369: union
370: select b.parent_level_id
368: and c.demand_plan_id = p_demand_plan_id
369: union
370: select b.parent_level_id
371: from msd_hierarchy_levels b,
372: msd_dp_hierarchies_v c
373: where b.hierarchy_id = c.hierarchy_id
374: and c.demand_plan_id = p_demand_plan_id
375: );
376:
446: AND mcd.name = mdp.parameter_type
447: AND nvl(mcdd.collect_level_id, 0) not in
448: ( select b.level_id
449: from msd_hierarchy_levels b,
450: msd_dp_hierarchies_v c
451: where b.hierarchy_id = c.hierarchy_id
452: and c.demand_plan_id = p_demand_plan_id
453: and mcdd.dimension_code <> 'TIM'
454: union
453: and mcdd.dimension_code <> 'TIM'
454: union
455: select b.parent_level_id
456: from msd_hierarchy_levels b,
457: msd_dp_hierarchies_v c
458: where b.hierarchy_id = c.hierarchy_id
459: and c.demand_plan_id = p_demand_plan_id
460: and mcdd.dimension_code <> 'TIM'
461: );
463: -- Determine whether level is contain in Dp Hierarchies.
464: CURSOR get_inv_hier_lvl_prms (p_demand_plan_id IN NUMBER, p_lvl_id in NUMBER) is
465: select 1
466: from msd_hierarchy_levels b,
467: msd_dp_hierarchies_v c
468: where b.hierarchy_id = c.hierarchy_id
469: and c.demand_plan_id = p_demand_plan_id
470: and (b.level_id = p_lvl_id
471: or