The following lines contain the word 'select', 'insert', 'update' or 'delete':
, x_delete_list OUT NOCOPY PO_TBL_NUMBER
, x_insert_list OUT NOCOPY PO_TBL_NUMBER
, x_update_list OUT NOCOPY PO_TBL_NUMBER
);
INSERT INTO po_session_gt
( key,
num1
)
SELECT l_key,
l_index_tbl(i)
FROM DUAL
WHERE EXISTS (SELECT 1
FROM po_line_locations_draft_all PLLD
WHERE PLLD.draft_id = p_draft_id_tbl(i)
AND PLLD.line_location_id = NVL(p_line_location_id_tbl(i),
PLLD.line_location_id)
AND NVL(PLLD.change_accepted_flag, 'Y') = 'Y');
DELETE FROM po_session_gt
WHERE key = l_key
RETURNING num1
BULK COLLECT INTO l_dft_exists_index_tbl;
l_delete_list PO_TBL_NUMBER;
l_insert_list PO_TBL_NUMBER;
l_update_list PO_TBL_NUMBER;
, x_delete_list => l_delete_list
, x_insert_list => l_insert_list
, x_update_list => l_update_list
);
IF (l_delete_list.COUNT > 0) THEN
IF (PO_LOG.d_stmt) THEN
PO_LOG.stmt(d_module, d_position, 'Deleted Lines Found');
SELECT 'Y'
INTO l_clm_document
FROM po_headers_all h,
po_doc_style_headers pdsh,
po_line_locations_all pll
WHERE h.style_id = pdsh.style_id
AND h.po_header_id = pll.po_header_id
AND pll.line_location_id = l_delete_list(1)
AND NVL(pdsh.clm_flag,'N') = 'Y'
AND ROWNUM = 1;
FOR i IN 1..l_delete_list.COUNT LOOP
-- Bug: 13948625, Call same old remove_req_from_po in case of Commercial PO line deleted from BWC.
-- Schedules cannot be deleted for BWC for CLM documents.
IF (l_clm_document <> 'Y') THEN
PO_REQ_LINES_SV.remove_req_from_po (l_delete_list(i), 'SHIPMENT');
PO_LOG.stmt(d_module, d_position, 'Calling delete_attachments');
FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments
( 'PO_SHIPMENTS',
l_delete_list(i),
'','','','','', ''
);
l_delete_flag_tbl PO_TBL_VARCHAR1;
INSERT INTO po_session_gt
( key,
num1
)
SELECT l_key,
POLLD.po_line_id
FROM po_line_locations_draft_all POLLD,
po_line_locations_all POLL
WHERE POLLD.draft_id = p_draft_info.draft_id
AND POLLD.line_location_id = POLL.line_location_id (+)
AND NVL(POLLD.change_accepted_flag, 'Y') = 'Y'
AND (NVL(POLLD.delete_flag, 'N') = 'Y' OR
POLL.line_location_id IS NULL);
INSERT INTO po_session_gt
( key,
num1
)
SELECT l_key,
POLLD.po_line_id
FROM po_line_locations_draft_all POLLD,
po_line_locations_all POLL
WHERE POLLD.draft_id = p_draft_info.draft_id
AND POLLD.line_location_id = POLL.line_location_id
AND NVL(POLLD.change_accepted_flag, 'Y') = 'Y'
AND NVL(POLLD.delete_flag, 'N') = 'N'
AND (DECODE (POLLD.ship_to_organization_id,
POLL.ship_to_organization_id, 'Y', 'N') = 'N' OR
DECODE (POLLD.ship_to_location_id,
POLL.ship_to_location_id, 'Y', 'N') = 'N' OR
DECODE (POLLD.quantity,
POLL.quantity, 'Y', 'N') = 'N' OR
DECODE (POLLD.price_override,
POLL.price_override, 'Y', 'N') = 'N' OR
DECODE (POLLD.price_discount,
POLL.price_discount, 'Y', 'N') = 'N' OR
DECODE (POLLD.start_date,
POLL.start_date, 'Y', 'N') = 'N' OR
DECODE (POLLD.end_date,
POLL.end_date, 'Y', 'N') = 'N');
DELETE FROM po_session_gt
WHERE key = l_key
RETURNING num1, p_draft_info.draft_id, NULL
BULK COLLECT
INTO l_po_line_id_tbl, l_draft_id_tbl, l_delete_flag_tbl;
p_delete_flag_tbl => l_delete_flag_tbl,
x_record_already_exist_tbl => l_record_exist_tbl
);
UPDATE po_lines_draft_all
SET retroactive_date = SYSDATE
WHERE draft_id = p_draft_info.draft_id
AND po_line_id = l_po_line_id_tbl(i);
, x_delete_list OUT NOCOPY PO_TBL_NUMBER
, x_insert_list OUT NOCOPY PO_TBL_NUMBER
, x_update_list OUT NOCOPY PO_TBL_NUMBER
) IS
d_api_name CONSTANT VARCHAR2(30) := 'group_records_by_dml_type';
x_delete_list := PO_TBL_NUMBER();
x_insert_list := PO_TBL_NUMBER();
x_update_list := PO_TBL_NUMBER();
SELECT PLLD.line_location_id,
NVL(PLLD.delete_flag, 'N'),
DECODE(PLL.po_line_id, NULL, 'N', 'Y')
BULK COLLECT
INTO l_id_list,
l_del_flag_list,
l_txn_exists_list
FROM po_line_locations_draft_all PLLD,
po_line_locations_all PLL
WHERE PLLD.draft_id = p_draft_info.draft_id
AND NVL(PLLD.change_accepted_flag, 'Y') = 'Y'
AND PLLD.line_location_id = PLL.line_location_id(+);
x_delete_list.extend;
x_delete_list(x_delete_list.LAST) := l_id_list(i);
x_update_list.extend;
x_update_list(x_update_list.LAST) := l_id_list(i);
x_insert_list.extend;
x_insert_list(x_insert_list.LAST) := l_id_list(i);