51: where demand_plan_id = p_source_demand_plan_id
52: and (nvl(supply_plan_flag,'N') = 'N'
53: or p_source_demand_plan_id not in
54: (select demand_plan_id
55: from msd_demand_plans
56: where template_flag = 'Y'));
57:
58: cursor cur_document is
59: select document_id
66: where demand_plan_id = p_source_demand_plan_id
67: and (nvl(supply_plan_flag,'N') = 'N'
68: or p_source_demand_plan_id not in
69: (select demand_plan_id
70: from msd_demand_plans
71: where template_flag = 'Y'))
72: order by creation_sequence;
73:
74: cursor get_template_flag is
72: order by creation_sequence;
73:
74: cursor get_template_flag is
75: select template_flag
76: from msd_demand_plans
77: where demand_plan_id=p_source_demand_plan_id;
78:
79: cursor get_template_id is
80: select template_id
77: where demand_plan_id=p_source_demand_plan_id;
78:
79: cursor get_template_id is
80: select template_id
81: from msd_demand_plans
82: where demand_plan_id=x_demand_plan_id;
83:
84: cursor replace_equation(p_demand_plan_id number) is
85: select parameter_type,equation,post_calculation
106:
107: lv_status_id := 5;
108:
109: select count(*) into x_dp_exists
110: from msd_demand_plans
111: where demand_plan_id = p_source_demand_plan_id;
112: if x_dp_exists = 0 then
113: raise No_Source_Dp ;
114: end if ;
115:
116:
117: lv_status_id := 10;
118:
119: INSERT INTO msd_demand_plans
120: ( DEMAND_PLAN_ID
121: ,ORGANIZATION_ID
122: ,DEMAND_PLAN_NAME
123: ,DESCRIPTION
251: ,dp.PREV_LIAB_PUB_PLAN_START_DATE
252: ,dp.PREVIOUS_PLAN_START_DATE
253: ,dp.LIABILITY_REVISION_NUM
254: FROM
255: msd_demand_plans dp
256: WHERE
257: DEMAND_PLAN_ID = p_source_demand_plan_id ;
258:
259: INSERT INTO msd_demand_plans_tl
255: msd_demand_plans dp
256: WHERE
257: DEMAND_PLAN_ID = p_source_demand_plan_id ;
258:
259: INSERT INTO msd_demand_plans_tl
260: (
261: DEMAND_PLAN_ID
262: ,DESCRIPTION
263: ,LANGUAGE
442: and nvl(par.stream_type,'ABCD') not in ('ARCHIVED','ARCHIVED_TIM')
443: and (nvl(supply_plan_flag,'N') = 'N'
444: or p_source_demand_plan_id not in
445: (select demand_plan_id
446: from msd_demand_plans
447: where template_flag = 'Y'));
448:
449: open get_template_flag;
450: fetch get_template_flag into l_template_flag;
1142: where mdfp.demand_plan_id in
1143:
1144: (select demand_plan_id
1145:
1146: from msd_demand_plans
1147:
1148: where plan_type = 'EOL'
1149:
1150: and template_flag = 'Y'
1426: and demand_plan_id = p_source_demand_plan_id
1427: and (nvl(supply_plan_flag,'N') = 'N'
1428: or p_source_demand_plan_id not in
1429: (select demand_plan_id
1430: from msd_demand_plans
1431: where template_flag = 'Y'));
1432:
1433: END LOOP;
1434: