DBA Data[Home] [Help]

APPS.MSC_PHUB_PKG dependencies on MSC_PLAN_RUNS

Line 79: from msc_plan_runs

75: is
76: r msc_apcc_number_list;
77: begin
78: select plan_run_id bulk collect into r
79: from msc_plan_runs
80: where (plan_name=p_plan_name and plan_run_id=nvl(p_plan_run_id,plan_run_id))
81: and archive_flag=1
82: union
83: select p_plan_run_id from dual where p_plan_run_id is not null;

Line 436: select plan_name into l_plan_name from msc_plan_runs where plan_run_id=p_plan_run_id;

432: l_plan_name varchar2(50);
433: begin
434: msc_phub_util.log('msc_phub_pkg.purge_previous_plan_run('||p_plan_run_id||')');
435:
436: select plan_name into l_plan_name from msc_plan_runs where plan_run_id=p_plan_run_id;
437:
438: select max(plan_run_id)
439: into l_prev_plan_run_id
440: from msc_plan_runs

Line 440: from msc_plan_runs

436: select plan_name into l_plan_name from msc_plan_runs where plan_run_id=p_plan_run_id;
437:
438: select max(plan_run_id)
439: into l_prev_plan_run_id
440: from msc_plan_runs
441: where plan_name=l_plan_name
442: and plan_run_id 443: and nvl(archive_flag,sys_no)=sys_yes;
444:

Line 542: from msc_plan_runs

538: plan_cutoff_date,
539: plan_completion_date,
540: publisher
541: into l_pi
542: from msc_plan_runs
543: where plan_id=p_plan_id and plan_run_id=p_plan_run_id;
544:
545: if (p_archive_flag = 2) then
546: l_upload_mode := 4;

Line 697: from msc_plan_runs

693: end if;
694:
695: -- validate inputs
696: select count(1) into l_n
697: from msc_plan_runs
698: where plan_name=l_pi.plan_name
699: and archive_flag=1
700: and local_archive_flag=2;
701:

Line 712: from msc_plan_runs

708: end if;
709:
710: begin
711: select plan_type into l_plan_type
712: from msc_plan_runs
713: where plan_name=l_pi.plan_name
714: and archive_flag=1
715: and plan_type<>l_pi.plan_type
716: and rownum=1;

Line 799: update msc_plan_runs set

795:
796: exception
797: when others then
798: if (l_plan_run_id > 0) then
799: update msc_plan_runs set
800: archive_flag=decode(archive_flag, 3, 2, archive_flag),
801: last_update_date = sysdate
802: where plan_run_id=l_plan_run_id;
803: commit;

Line 829: update msc_plan_runs set

825:
826: for r in c loop
827: manage_partitions(list_fact_tables(null), r.plan_run_id, partition_drop, partition_range);
828:
829: update msc_plan_runs set
830: planning_hub_flag = sys_no,
831: last_run_flag = sys_no,
832: archive_flag = sys_no,
833: last_update_date = sysdate,

Line 848: from msc_plan_runs

844: end loop;
845:
846: select plan_id, plan_name
847: into l_plan_id, l_plan_name
848: from msc_plan_runs
849: where plan_run_id in (select column_value from table(l_purge_list))
850: and rownum=1;
851:
852: select max(plan_run_id)

Line 854: from msc_plan_runs

850: and rownum=1;
851:
852: select max(plan_run_id)
853: into l_last_plan_run_id
854: from msc_plan_runs
855: where plan_name=l_plan_name
856: and archive_flag=1;
857:
858: if (l_last_plan_run_id > 0) then

Line 859: update msc_plan_runs set

855: where plan_name=l_plan_name
856: and archive_flag=1;
857:
858: if (l_last_plan_run_id > 0) then
859: update msc_plan_runs set
860: last_run_flag = 1,
861: last_update_date = sysdate,
862: last_updated_by = fnd_global.user_id,
863: last_update_login = fnd_global.login_id,

Line 1010: from msc_plan_runs

1006:
1007: if (p_plan_run_id is not null) then
1008: select plan_name, sr_instance_id, plan_type, temp_transfer_id
1009: into l_plan_name, l_sr_instance_id, l_plan_type, l_transfer_id
1010: from msc_plan_runs
1011: where plan_run_id=p_plan_run_id;
1012:
1013: if (p_success = sys_yes) then
1014: update msc_plan_runs set

Line 1014: update msc_plan_runs set

1010: from msc_plan_runs
1011: where plan_run_id=p_plan_run_id;
1012:
1013: if (p_success = sys_yes) then
1014: update msc_plan_runs set
1015: last_run_flag=sys_no,
1016: last_update_date = sysdate,
1017: last_updated_by = fnd_global.user_id,
1018: last_update_login = fnd_global.login_id

Line 1023: update msc_plan_runs set

1019: where plan_name = l_plan_name
1020: and plan_run_id < p_plan_run_id
1021: and (p_plan_id<>-1 or sr_instance_id=l_sr_instance_id);
1022:
1023: update msc_plan_runs set
1024: last_run_flag=sys_yes,
1025: planning_hub_flag=sys_yes,
1026: end_date=sysdate,
1027: archive_flag=p_archive_flag

Line 1030: update msc_plan_runs set end_date=sysdate

1026: end_date=sysdate,
1027: archive_flag=p_archive_flag
1028: where plan_id=p_plan_id and plan_run_id=p_plan_run_id;
1029: else
1030: update msc_plan_runs set end_date=sysdate
1031: where plan_id=p_plan_id and plan_run_id=p_plan_run_id;
1032: end if;
1033: commit;
1034: end if;

Line 1114: dbms_lock.allocate_unique('msc_plan_runs_s', l_lock);

1110: end if;
1111:
1112: if (l_fact_tables.count > 0) then
1113: -- create fact partitions synchronuously
1114: dbms_lock.allocate_unique('msc_plan_runs_s', l_lock);
1115: msc_phub_util.log('msc_phub_pkg.create_fact_partitions: dbms_lock.request');
1116: l_error := dbms_lock.request(l_lock);
1117: if (l_error <> 0) then
1118: msc_phub_util.log('msc_phub_pkg.create_fact_partitions: dbms_lock.request='||l_error);

Line 1122: select msc_plan_runs_s.nextval into l_plan_run_id from dual;

1118: msc_phub_util.log('msc_phub_pkg.create_fact_partitions: dbms_lock.request='||l_error);
1119: raise e_create_fact_partitions;
1120: end if;
1121:
1122: select msc_plan_runs_s.nextval into l_plan_run_id from dual;
1123: manage_partitions(l_fact_tables, l_plan_run_id, partition_add, partition_range);
1124: l_error := dbms_lock.release(l_lock);
1125: end if;
1126: return l_plan_run_id;

Line 1158: from msc_plan_runs

1154:
1155: -- check local_archive_flag
1156: begin
1157: select 1 into l_error
1158: from msc_plan_runs
1159: where plan_name=p_pi.plan_name
1160: and nvl(local_archive_flag,1) <> nvl(p_local_archive_flag,1)
1161: and rownum=1;
1162: exception

Line 1177: select nvl(max(plan_run_version), -1) + 1 into l_plan_version from msc_plan_runs where plan_name=p_pi.plan_name;

1173: l_transfer_id := create_staging_partitions(p_pi.plan_type, p_include_ods);
1174: end if;
1175:
1176: if (l_plan_run_id is not null) then
1177: select nvl(max(plan_run_version), -1) + 1 into l_plan_version from msc_plan_runs where plan_name=p_pi.plan_name;
1178:
1179: l_plan_run_name := p_pi.plan_name||
1180: to_char(p_pi.plan_completion_date, ' MM/DD')||
1181: '('||l_plan_version||')'||

Line 1184: insert into msc_plan_runs (

1180: to_char(p_pi.plan_completion_date, ' MM/DD')||
1181: '('||l_plan_version||')'||
1182: (case when p_scenario_name is not null then ' ['||p_scenario_name||']' end);
1183:
1184: insert into msc_plan_runs (
1185: plan_id, plan_run_id, plan_run_name, sr_instance_id, organization_id,
1186: plan_name, plan_type, plan_description, plan_run_version, scenario_name,
1187: plan_start_date, plan_cutoff_date, plan_completion_date, publisher,
1188: start_date, end_date, last_run_flag,

Line 1253: from msc_plan_runs

1249: msc_phub_util.log('msc_phub_pkg.build_null_items('||p_plan_id||')');
1250:
1251: begin
1252: select plan_type into l_plan_type
1253: from msc_plan_runs
1254: where plan_id=p_plan_id and rownum=1;
1255: exception
1256: when others then null;
1257: end;

Line 1946: from msc_plan_runs

1942: --check for existing collections data
1943: begin
1944: select plan_run_id, plan_run_name
1945: into l_plan_run_id, l_plan_run_name
1946: from msc_plan_runs
1947: where plan_id = con_ods_plan_id
1948: and sr_instance_id=p_sr_instance_id
1949: and archive_flag=1;
1950:

Line 1961: -- update msc_plan_runs

1957:
1958: -- prepare staging tables
1959: l_transfer_id := create_staging_partitions(l_pi.plan_type, sys_no);
1960:
1961: -- update msc_plan_runs
1962: update msc_plan_runs set
1963: refresh_mode = p_refresh_mode,
1964: plan_type = l_pi.plan_type,
1965: sr_instance_id = p_sr_instance_id,

Line 1962: update msc_plan_runs set

1958: -- prepare staging tables
1959: l_transfer_id := create_staging_partitions(l_pi.plan_type, sys_no);
1960:
1961: -- update msc_plan_runs
1962: update msc_plan_runs set
1963: refresh_mode = p_refresh_mode,
1964: plan_type = l_pi.plan_type,
1965: sr_instance_id = p_sr_instance_id,
1966: organization_id = l_pi.organization_id,

Line 2002: update msc_plan_runs set lcid = l_lcid

1998: retcode := -1;
1999: errbuf := 'Error while populating the fact tables. purging this plan summary. ';
2000: msc_phub_util.log(errbuf);
2001: else
2002: update msc_plan_runs set lcid = l_lcid
2003: where plan_run_id=l_plan_run_id;
2004: commit;
2005: end if;
2006: finalize_plan_run(-1, l_plan_run_id, sys_no, sys_yes, l_return_status, sys_yes);

Line 2079: (select plan_run_id from msc_plan_runs where archive_flag=2)

2075: from all_tab_partitions
2076: where table_owner=l_msc_schema
2077: and table_name=p_table
2078: and to_number(substr(partition_name, length(p_table)-2)) in
2079: (select plan_run_id from msc_plan_runs where archive_flag=2)
2080: order by 1;
2081:
2082: e_partition_not_exist exception;
2083: pragma exception_init (e_partition_not_exist, -2149);

Line 2233: update msc_plan_runs set scenario_name = regexp_substr(plan_run_name, '\[.*\]', 1, 1);

2229:
2230: procedure migrate_scenario_names is
2231: begin
2232: msc_phub_util.log('msc_phub_pkg.migrate_scenario_names');
2233: update msc_plan_runs set scenario_name = regexp_substr(plan_run_name, '\[.*\]', 1, 1);
2234: update msc_plan_runs set scenario_name = substr(scenario_name, 2, length(scenario_name)-2);
2235: commit;
2236:
2237: update msc_plan_runs set last_run_flag=2

Line 2234: update msc_plan_runs set scenario_name = substr(scenario_name, 2, length(scenario_name)-2);

2230: procedure migrate_scenario_names is
2231: begin
2232: msc_phub_util.log('msc_phub_pkg.migrate_scenario_names');
2233: update msc_plan_runs set scenario_name = regexp_substr(plan_run_name, '\[.*\]', 1, 1);
2234: update msc_plan_runs set scenario_name = substr(scenario_name, 2, length(scenario_name)-2);
2235: commit;
2236:
2237: update msc_plan_runs set last_run_flag=2
2238: where plan_run_id in

Line 2237: update msc_plan_runs set last_run_flag=2

2233: update msc_plan_runs set scenario_name = regexp_substr(plan_run_name, '\[.*\]', 1, 1);
2234: update msc_plan_runs set scenario_name = substr(scenario_name, 2, length(scenario_name)-2);
2235: commit;
2236:
2237: update msc_plan_runs set last_run_flag=2
2238: where plan_run_id in
2239: (select plan_run_id from
2240: (select plan_name, plan_run_id,
2241: last_value(plan_run_id) over(partition by plan_name order by plan_run_id

Line 2243: from msc_plan_runs

2239: (select plan_run_id from
2240: (select plan_name, plan_run_id,
2241: last_value(plan_run_id) over(partition by plan_name order by plan_run_id
2242: rows between unbounded preceding and unbounded following) last_plan_run_id
2243: from msc_plan_runs
2244: where plan_name in
2245: (select plan_name
2246: from msc_plan_runs
2247: where last_run_flag=1

Line 2246: from msc_plan_runs

2242: rows between unbounded preceding and unbounded following) last_plan_run_id
2243: from msc_plan_runs
2244: where plan_name in
2245: (select plan_name
2246: from msc_plan_runs
2247: where last_run_flag=1
2248: group by plan_name
2249: having count(*)>1
2250: )

Line 2279: msc_phub_util.log('delete from msc_plan_runs where plan_id=0 and plan_run_id=-1');

2275: clean_up_customer_keys;
2276: end if;
2277:
2278: -- clear migration flag
2279: msc_phub_util.log('delete from msc_plan_runs where plan_id=0 and plan_run_id=-1');
2280: delete from msc_plan_runs where plan_id=0 and plan_run_id=-1;
2281: commit;
2282:
2283: exception

Line 2280: delete from msc_plan_runs where plan_id=0 and plan_run_id=-1;

2276: end if;
2277:
2278: -- clear migration flag
2279: msc_phub_util.log('delete from msc_plan_runs where plan_id=0 and plan_run_id=-1');
2280: delete from msc_plan_runs where plan_id=0 and plan_run_id=-1;
2281: commit;
2282:
2283: exception
2284: when others then

Line 2300: from msc_plan_runs

2296: msc_phub_util.log('msc_phub_pkg.check_migrate');
2297:
2298: -- check migration flag
2299: select count(*) into l_need_migrate
2300: from msc_plan_runs
2301: where plan_id=0 and plan_run_id=-1;
2302:
2303: msc_phub_util.log('msc_phub_pkg.check_migrate, l_need_migrate='||l_need_migrate);
2304: