The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE update_approval_status
( p_draft_info IN PO_DRAFTS_PVT.DRAFT_INFO_REC_TYPE,
x_rebuild_attribs OUT NOCOPY BOOLEAN
) IS
d_api_name CONSTANT VARCHAR2(30) := 'udpate_approval_status';
SELECT NVL(authorization_status, 'INCOMPLETE'),
NVL(approved_flag, 'N'),
type_lookup_code --Bug#5264722
INTO l_orig_auth_status,
l_orig_approved_flag,
l_type_lookup_code --Bug#5264722
FROM po_headers_all
WHERE po_header_id = p_draft_info.po_header_id;
UPDATE po_headers_all
SET authorization_status = l_new_auth_status,
approved_flag = l_new_approved_flag,
last_update_date = SYSDATE
WHERE po_header_id = p_draft_info.po_header_id;
UPDATE po_headers_draft_all
SET authorization_status = l_new_auth_status,
approved_flag = l_new_approved_flag,
last_update_date = SYSDATE
WHERE po_header_id = p_draft_info.po_header_id
AND draft_id = p_draft_info.draft_id;
END update_approval_status;
'Update shipment approved flag for shipment changes');
UPDATE po_line_locations_draft_all
SET approved_flag = 'R'
WHERE line_location_id = l_line_loc_list1(i)
AND draft_id = p_draft_info.draft_id
AND approved_flag = 'Y';
'Update shipment approved flag for distribution changes');
UPDATE po_line_locations_draft_all
SET approved_flag = 'R'
WHERE line_location_id = l_line_loc_list2(i)
AND draft_id = p_draft_info.draft_id
AND approved_flag = 'Y';
UPDATE po_line_locations_all
SET approved_flag = 'R'
WHERE line_location_id = l_line_loc_list2(i)
AND approved_flag = 'Y';
SELECT MAX(FND_API.G_TRUE)
INTO l_different
FROM dual
WHERE EXISTS
( SELECT NULL
FROM po_headers_draft_all PHD,
po_headers_all PH
WHERE PHD.po_header_id = p_draft_info.po_header_id
AND PHD.draft_id = p_draft_info.draft_id
AND NVL(PHD.delete_flag, 'N') = 'N'
AND NVL(PHD.change_accepted_flag, 'Y') = 'Y'
AND PHD.po_header_id = PH.po_header_id
AND
( DECODE (PHD.agent_id, PH.agent_id, 'Y', 'N') = 'N'
OR DECODE (PHD.vendor_site_id, PH.vendor_site_id, 'Y', 'N') = 'N'
OR DECODE (PHD.vendor_contact_id, PH.vendor_contact_id, 'Y', 'N') = 'N'
OR DECODE (PHD.confirming_order_flag, PH.confirming_order_flag, 'Y', 'N') = 'N'
OR DECODE (PHD.ship_to_location_id, PH.ship_to_location_id, 'Y', 'N') = 'N'
OR DECODE (PHD.bill_to_location_id, PH.bill_to_location_id, 'Y', 'N') = 'N'
OR DECODE (PHD.terms_id, PH.terms_id, 'Y', 'N') = 'N'
OR DECODE (PHD.ship_via_lookup_code, PH.ship_via_lookup_code, 'Y', 'N') = 'N'
OR DECODE (PHD.fob_lookup_code, PH.fob_lookup_code, 'Y', 'N') = 'N'
OR DECODE (PHD.freight_terms_lookup_code, PH.freight_terms_lookup_code, 'Y', 'N') = 'N'
OR DECODE (PHD.note_to_vendor, PH.note_to_vendor, 'Y', 'N') = 'N'
OR DECODE (PHD.acceptance_required_flag, PH.acceptance_required_flag, 'Y', 'N') = 'N'
OR DECODE (PHD.blanket_total_amount, PH.blanket_total_amount, 'Y', 'N') = 'N'
OR DECODE (PHD.start_date, PH.start_date, 'Y', 'N') = 'N'
OR DECODE (PHD.end_date, PH.end_date, 'Y', 'N') = 'N'
OR DECODE (PHD.amount_limit, PH.amount_limit, 'Y', 'N') = 'N'
OR DECODE (PHD.conterms_articles_upd_date, PH.conterms_articles_upd_date, 'Y', 'N') = 'N'
OR DECODE (PHD.conterms_deliv_upd_date, PH.conterms_deliv_upd_date, 'Y', 'N') = 'N'
OR DECODE (PHD.shipping_control, PH.shipping_control, 'Y', 'N') = 'N'
)
);
SELECT MAX(FND_API.G_TRUE)
INTO l_has_new_records
FROM dual
WHERE EXISTS
( SELECT NULL
FROM po_lines_draft_all PLD
WHERE PLD.draft_id = p_draft_info.draft_id
AND NVL(PLD.delete_flag, 'N') = 'N'
AND NVL(PLD.change_accepted_flag, 'Y') = 'Y'
AND NOT EXISTS
( SELECT NULL
FROM po_lines_all PL
WHERE PLD.po_line_id = PL.po_line_id));
SELECT MAX(FND_API.G_TRUE)
INTO l_different
FROM dual
WHERE EXISTS
( SELECT NULL
FROM po_lines_draft_all PLD,
po_lines_all PL
WHERE PLD.draft_id = p_draft_info.draft_id
AND NVL(PLD.delete_flag, 'N') = 'N'
AND NVL(PLD.change_accepted_flag, 'Y') = 'Y'
AND PLD.po_line_id = PL.po_line_id
AND
( DECODE (PLD.unit_price, PL.unit_price, 'Y', 'N') = 'N'
OR DECODE (PLD.line_num, PL.line_num, 'Y', 'N') = 'N'
OR DECODE (PLD.item_id, PL.item_id, 'Y', 'N') = 'N'
OR DECODE (PLD.item_description, PL.item_description, 'Y', 'N') = 'N'
OR DECODE (PLD.quantity, PL.quantity, 'Y', 'N') = 'N'
OR DECODE (PLD.unit_meas_lookup_code, PL.unit_meas_lookup_code, 'Y', 'N') = 'N'
OR DECODE (PLD.from_header_id, PL.from_header_id, 'Y', 'N') = 'N'
OR DECODE (PLD.from_line_id, PL.from_line_id, 'Y', 'N') = 'N'
OR DECODE (PLD.hazard_class_id, PL.hazard_class_id, 'Y', 'N') = 'N'
OR DECODE (PLD.vendor_product_num, PL.vendor_product_num, 'Y', 'N') = 'N'
OR DECODE (PLD.un_number_id, PL.un_number_id, 'Y', 'N') = 'N'
OR DECODE (PLD.note_to_vendor, PL.note_to_vendor, 'Y', 'N') = 'N'
OR DECODE (PLD.item_revision, PL.item_revision, 'Y', 'N') = 'N'
OR DECODE (PLD.category_id, PL.category_id, 'Y', 'N') = 'N'
OR DECODE (PLD.price_type_lookup_code, PL.price_type_lookup_code, 'Y', 'N') = 'N'
OR DECODE (PLD.not_to_exceed_price, PL.not_to_exceed_price, 'Y', 'N') = 'N'
OR DECODE (PLD.contract_id, PL.contract_id, 'Y', 'N') = 'N'
OR DECODE (PLD.start_date, PL.start_date, 'Y', 'N') = 'N'
OR DECODE (PLD.expiration_date, PL.expiration_date, 'Y', 'N') = 'N'
OR DECODE (PLD.contractor_first_name, PL.contractor_first_name, 'Y', 'N') = 'N'
OR DECODE (PLD.contractor_last_name, PL.contractor_last_name, 'Y', 'N') = 'N'
OR DECODE (PLD.amount, PL.amount, 'Y', 'N') = 'N'
OR DECODE (PLD.quantity_committed, PL.quantity_committed, 'Y', 'N') = 'N'
OR DECODE (PLD.committed_amount, PL.committed_amount, 'Y', 'N') = 'N'
--
OR DECODE (PLD.retainage_rate, PL.retainage_rate, 'Y', 'N') = 'N'
OR DECODE (PLD.max_retainage_amount, PL.max_retainage_amount, 'Y', 'N') = 'N'
OR DECODE (PLD.progress_payment_rate, PL.progress_payment_rate, 'Y', 'N') = 'N'
OR DECODE (PLD.recoupment_rate, PL.recoupment_rate, 'Y', 'N') = 'N'
--
)
);
SELECT MAX(FND_API.G_TRUE)
INTO l_has_new_records
FROM dual
WHERE EXISTS
( SELECT NULL
FROM po_line_locations_draft_all PLLD
WHERE PLLD.draft_id = p_draft_info.draft_id
AND NVL(PLLD.delete_flag, 'N') = 'N'
AND NVL(PLLD.change_accepted_flag, 'Y') = 'Y'
AND NOT EXISTS
( SELECT NULL
FROM po_line_locations_all PLL
WHERE PLLD.line_location_id = PLL.line_location_id));
SELECT PLLD.line_location_id
BULK COLLECT
INTO x_changed_line_loc_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.delete_flag, 'N') = 'N'
AND NVL(PLLD.change_accepted_flag, 'Y') = 'Y'
AND PLLD.line_location_id = PLL.line_location_id
AND
( DECODE (PLLD.quantity, PLL.quantity, 'Y', 'N') = 'N'
OR DECODE (PLLD.ship_to_location_id, PLL.ship_to_location_id, 'Y', 'N') = 'N'
OR DECODE (PLLD.promised_date, PLL.promised_date, 'Y', 'N') = 'N'
OR DECODE (PLLD.need_by_date, PLL.need_by_date, 'Y', 'N') = 'N'
OR DECODE (PLLD.shipment_num, PLL.shipment_num, 'Y', 'N') = 'N'
OR DECODE (PLLD.start_date, PLL.start_date, 'Y', 'N') = 'N'
OR DECODE (PLLD.end_date, PLL.end_date, 'Y', 'N') = 'N'
OR DECODE (PLLD.days_early_receipt_allowed, PLL.days_early_receipt_allowed, 'Y', 'N') = 'N'
OR DECODE (PLLD.last_accept_date, PLL.last_accept_date, 'Y', 'N') = 'N'
OR DECODE (PLLD.price_discount, PLL.price_discount, 'Y', 'N') = 'N'
OR DECODE (PLLD.price_override, PLL.price_override, 'Y', 'N') = 'N'
OR DECODE (PLLD.ship_to_organization_id, PLL.ship_to_organization_id, 'Y', 'N') = 'N'
OR DECODE (PLLD.tax_code_id, PLL.tax_code_id, 'Y', 'N') = 'N'
--
OR DECODE (PLLD.amount, PLL.amount, 'Y', 'N') = 'N'
OR DECODE (PLLD.payment_type, PLL.payment_type, 'Y', 'N') = 'N'
OR DECODE (PLLD.description, PLL.description, 'Y', 'N') = 'N'
OR DECODE (PLLD.work_approver_id, PLL.work_approver_id, 'Y', 'N') = 'N'
--
);
SELECT MAX(FND_API.G_TRUE)
INTO l_has_new_records
FROM dual
WHERE EXISTS
( SELECT NULL
FROM po_distributions_draft_all PDD
WHERE PDD.draft_id = p_draft_info.draft_id
AND NVL(PDD.delete_flag, 'N') = 'N'
AND NVL(PDD.change_accepted_flag, 'Y') = 'Y'
AND NOT EXISTS
( SELECT NULL
FROM po_distributions_all PD
WHERE PDD.po_distribution_id = PD.po_distribution_id));
SELECT DISTINCT PDD.line_location_id
BULK COLLECT
INTO x_changed_line_loc_list
FROM po_distributions_draft_all PDD,
po_distributions_all PD
WHERE PDD.draft_id = p_draft_info.draft_id
AND NVL(PDD.delete_flag, 'N') = 'N'
AND NVL(PDD.change_accepted_flag, 'Y') = 'Y'
AND PDD.po_distribution_id = PD.po_distribution_id
AND
( DECODE (PDD.quantity_ordered, PD.quantity_ordered, 'Y', 'N') = 'N'
OR DECODE (PDD.amount_ordered, PD.amount_ordered, 'Y', 'N') = 'N'
OR DECODE (PDD.deliver_to_person_id, PD.deliver_to_person_id, 'Y', 'N') = 'N'
OR DECODE (PDD.rate_date, PD.rate_date, 'Y', 'N') = 'N'
OR DECODE (PDD.rate, PD.rate, 'Y', 'N') = 'N'
OR DECODE (PDD.gl_encumbered_date, PD.gl_encumbered_date, 'Y', 'N') = 'N'
OR DECODE (PDD.recovery_rate, PD.recovery_rate, 'Y', 'N') = 'N'
OR DECODE (PDD.destination_subinventory, PD.destination_subinventory, 'Y', 'N') = 'N'
OR DECODE (PDD.code_combination_id, PD.code_combination_id, 'Y', 'N') = 'N'
OR DECODE (PDD.dest_charge_account_id, PD.dest_charge_account_id, 'Y', 'N') = 'N'
OR DECODE (PDD.distribution_num, PD.distribution_num, 'Y', 'N') = 'N'
);