The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE NAME: delete_osfm_tables
===========================================================================*/
procedure append_report(
p_rec in wip_wictpg.purge_report_type,
p_option in number
)
is
begin
if ( p_option IN (REPORT_ONLY, PURGE_AND_REPORT) ) then
insert into Wip_temp_reports(
key1, /* Group ID */
program_source,
last_updated_by,
organization_id,
wip_entity_id,
inventory_item_id,
key2, /* line ID */
key3, /* Repetitive schedule ID */
description, /* Table Name */
key6, /* Info Type */
attribute1 /* Info */,
date1, /* Start Date */
date2, /* Completion Date */
date3, /* Close Date */
attribute2, /*Job Name*/
attribute3 /*Line Code*/
) values (
p_rec.group_id,
'WICTPG', /* program_source */
-1, /* Last Updated By */
p_rec.org_id,
p_rec.wip_entity_id,
p_rec.primary_item_id,
p_rec.line_id,
p_rec.schedule_id,
p_rec.table_name,
p_rec.info_type,
p_rec.info,
p_rec.start_date,
p_rec.complete_date,
p_rec.close_date,
p_rec.entity_name,
p_rec.line_code
);
procedure delete_wie (
p_option in number,
p_header_id in number,
p_request_id in number,
p_wie_num_rows out NOCOPY number,
p_err_num in out NOCOPY number,
p_err_buf in out NOCOPY varchar2
)
is
begin
if (p_option = REPORT_ONLY) then
select count(*)
into p_wie_num_rows
from WSM_INTERFACE_ERRORS
where header_id = p_header_id
and request_id = nvl(p_request_id, -1);
DELETE FROM WSM_INTERFACE_ERRORS
WHERE header_id = p_header_id
and request_id = nvl(p_request_id, -1);
end delete_wie;
procedure delete_osfm_tables(
p_option in number,
p_group_id in number,
p_purge_request in wip_wictpg.get_purge_requests%rowtype,
-- ST Fix for bug 4918553 (Added the parameter p_detail_flag)
p_detail_flag IN BOOLEAN DEFAULT TRUE,
p_return_status out NOCOPY varchar2
)
is
x_num_rows number := 0;
e_delete_wie_exception EXCEPTION;
select wtxni.header_id, wtxni.request_id
from wsm_split_merge_txn_interface wtxni
where wtxni.organization_id = pOrgId
and wtxni.header_id in (
select sj.header_id
from wsm_starting_jobs_interface sj
where sj.wip_entity_id = pWipEntityId
union
select rj.header_id
from wsm_resulting_jobs_interface rj
where rj.wip_entity_name = pEntityName
);
select wlji.header_id, wlji.request_id
from WSM_LOT_JOB_INTERFACE wlji
where wlji.job_name = pEntityName
and wlji.organization_id = pOrgId;
select wlmti.header_id, wlmti.request_id
from WSM_LOT_MOVE_TXN_INTERFACE wlmti
where wlmti.wip_entity_id = pWipEntityId
and wlmti.organization_id = pOrgId;
delete_wie(
p_option => p_option,
p_header_id => x_header_id,
p_request_id => x_request_id,
p_wie_num_rows => x_tmp_num_rows,
p_err_num => p_err_num,
p_err_buf => p_err_buf
);
raise e_delete_wie_exception;
select count(*)
into x_tmp_num_rows
from WSM_STARTING_JOBS_INTERFACE
where header_id = x_header_id;
DELETE FROM WSM_STARTING_JOBS_INTERFACE
WHERE header_id = x_header_id;
select count(*)
into x_tmp_num_rows
from WSM_RESULTING_JOBS_INTERFACE
where header_id = x_header_id;
DELETE FROM WSM_RESULTING_JOBS_INTERFACE
WHERE header_id = x_header_id;
select count(*)
into x_tmp_num_rows
from WSM_SPLIT_MERGE_TXN_INTERFACE
where header_id = x_header_id;
DELETE FROM WSM_SPLIT_MERGE_TXN_INTERFACE
WHERE header_id = x_header_id;
SELECT count(*)
INTO x_tmp_num_rows
FROM WSM_SERIAL_TXN_INTERFACE
WHERE header_id = x_header_id
AND transaction_type_id = 3;
DELETE FROM WSM_SERIAL_TXN_INTERFACE
WHERE header_id = x_header_id
AND transaction_type_id = 3;
delete_wie(
p_option => p_option,
p_header_id => x_header_id,
p_request_id => x_request_id,
p_wie_num_rows => x_tmp_num_rows,
p_err_num => p_err_num,
p_err_buf => p_err_buf
);
raise e_delete_wie_exception;
SELECT count(*)
INTO x_tmp_num_rows
FROM WSM_SERIAL_TXN_INTERFACE
WHERE header_id = x_header_id
AND transaction_type_id = 1;
DELETE FROM WSM_SERIAL_TXN_INTERFACE
WHERE header_id = x_header_id
AND transaction_type_id = 1;
select count(*)
into x_num_rows
from WSM_LOT_JOB_INTERFACE
where job_name = x_purge_rec.entity_name
and organization_id = x_purge_rec.org_id;
DELETE FROM WSM_LOT_JOB_INTERFACE
WHERE job_name = x_purge_rec.entity_name
AND organization_id = x_purge_rec.org_id;
delete_wie(
p_option => p_option,
p_header_id => x_header_id,
p_request_id => x_request_id,
p_wie_num_rows => x_tmp_num_rows,
p_err_num => p_err_num,
p_err_buf => p_err_buf
);
raise e_delete_wie_exception;
SELECT count(*)
INTO x_tmp_num_rows
FROM WSM_SERIAL_TXN_INTERFACE
WHERE header_id = x_header_id
AND transaction_type_id = 2;
DELETE FROM WSM_SERIAL_TXN_INTERFACE
WHERE header_id = x_header_id
AND transaction_type_id = 2;
select count(*)
into x_num_rows
from WSM_LOT_MOVE_TXN_INTERFACE
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_LOT_MOVE_TXN_INTERFACE
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
SELECT COUNT(*)
INTO x_num_rows
FROM WSM_RESERVATIONS
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_RESERVATIONS
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
SELECT COUNT(*)
INTO x_num_rows
FROM WSM_OP_REASON_CODES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_OP_REASON_CODES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
SELECT COUNT(*)
INTO x_num_rows
FROM WSM_OP_SECONDARY_QUANTITIES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_OP_SECONDARY_QUANTITIES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
SELECT COUNT(*)
INTO x_num_rows
FROM WIP_RESOURCE_ACTUAL_TIMES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WIP_RESOURCE_ACTUAL_TIMES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
SELECT COUNT(*)
INTO x_num_rows
FROM WSM_JOB_SECONDARY_QUANTITIES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_JOB_SECONDARY_QUANTITIES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
select count(*)
into x_num_rows
from WIP_OPERATION_YIELDS
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WIP_OPERATION_YIELDS
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
select count(*)
into x_num_rows
from WSM_COPY_OPERATIONS
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_COPY_OPERATIONS
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
select count(*)
into x_num_rows
from WSM_COPY_OP_NETWORKS
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_COPY_OP_NETWORKS
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
select count(*)
into x_num_rows
from WSM_COPY_OP_RESOURCES
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_COPY_OP_RESOURCES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
select count(*)
into x_num_rows
from WSM_COPY_OP_RESOURCE_INSTANCES
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_COPY_OP_RESOURCE_INSTANCES
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
select count(*)
into x_num_rows
from WSM_COPY_OP_RESOURCE_USAGE
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_COPY_OP_RESOURCE_USAGE
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
select count(*)
into x_num_rows
from WSM_COPY_REQUIREMENT_OPS
where wip_entity_id = x_purge_rec.wip_entity_id;
DELETE FROM WSM_COPY_REQUIREMENT_OPS
WHERE wip_entity_id = x_purge_rec.wip_entity_id;
FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments(
X_entity_name => 'WSM_LOT_BASED_OPERATIONS',
X_pk1_value => to_char(x_purge_rec.wip_entity_id),
X_pk2_value => to_char(x_purge_rec.org_id),
X_delete_document_flag => 'Y' );
when e_delete_wie_exception then
append_report(x_purge_rec, p_option);
end delete_osfm_tables;