The following lines contain the word 'select', 'insert', 'update' or 'delete':
INSERT INTO po_session_gt
( key,
num1
)
SELECT l_key,
l_index_tbl(i)
FROM DUAL
WHERE EXISTS (SELECT 1
FROM po_headers_draft_all PHD
WHERE PHD.draft_id = p_draft_id_tbl(i)
AND PHD.po_header_id = NVL(p_po_header_id_tbl(i),
PHD.po_header_id)
AND NVL(PHD.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_flag PO_HEADERS_DRAFT_ALL.delete_flag%TYPE;
SELECT NVL(PHD.delete_flag, 'N'),
DECODE (PH.po_header_id, NULL, 'N', 'Y')
INTO l_delete_flag, l_record_exists_in_txn
FROM po_headers_draft_all PHD,
po_headers_all PH
WHERE PHD.draft_id = p_draft_info.draft_id
AND PHD.po_header_id = p_draft_info.po_header_Id
AND NVL(PHD.change_accepted_flag, 'Y') = 'Y'
AND PHD.po_header_id = PH.po_header_id(+);
IF (l_delete_flag = 'Y') THEN
IF (l_record_exists_in_txn = 'Y') THEN
l_dml_operation := 'DELETE';
l_dml_operation := 'UPDATE';
l_dml_operation := 'INSERT';
IF (l_dml_operation = 'UPDATE') THEN
SELECT DECODE (PHD.vendor_id, PH.vendor_id, 'Y', 'N'),
DECODE (PHD.vendor_site_id, PH.vendor_site_id, 'Y', 'N'),
NVL(PH.conterms_exist_flag, 'N'),
PHD.vendor_id,
PHD.vendor_site_id
INTO l_vendor_changed,
l_vendor_site_changed,
l_conterms_exist_flag,
l_new_vendor_id,
l_new_vendor_site_id
FROM po_headers_draft_all PHD,
po_headers_all PH
WHERE PHD.draft_id = p_draft_info.draft_id
AND PHD.po_header_id = p_draft_info.po_header_id
AND PHD.po_header_id = PH.po_header_id;
IF (l_dml_operation = 'DELETE') THEN
-- No need to delete children because OA will handle it
NULL;
IF (l_dml_operation = 'DELETE') THEN
d_position := 50;
FND_ATTACHED_DOCUMENTS2_PKG.delete_attachments
( 'PO_HEADERS',
p_draft_info.po_header_id,
'', '', '', '', 'Y');
SELECT NVL(PH.conterms_exist_flag, 'N')
INTO l_conterms_exist_flag
FROM po_headers_all PH
WHERE po_header_id = p_draft_info.po_header_id;
OKC_TERMS_UTIL_GRP.delete_doc
( p_api_version => 1.0
, p_init_msg_list => FND_API.G_TRUE
, p_commit => FND_API.G_FALSE
, p_doc_id => p_draft_info.po_header_id
, p_doc_type => l_contract_document_type
, p_validate_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_data => l_msg_data
, x_msg_count => l_msg_count
);
ELSIF (l_dml_operation = 'UPDATE') THEN
d_position := 70;
OKC_MANAGE_DELIVERABLES_GRP.updateExtPartyOnDeliverables
( p_api_version => 1.0
, p_bus_doc_id => p_draft_info.po_header_id
, p_bus_doc_type => l_contract_document_type
, p_external_party_id => l_new_vendor_id
, p_external_party_site_id => l_new_vendor_site_id
, x_msg_data => l_msg_data
, x_msg_count => l_msg_count
, x_return_status => l_return_status
);