The following lines contain the word 'select', 'insert', 'update' or 'delete':
UPDATE ak_web_user_sec_attr_values
SET number_value = p_new_vendor_site_id
WHERE attribute_code = 'ICX_SUPPLIER_SITE_ID'
AND attribute_application_id = 177
AND number_value = p_old_vendor_site_id;
UPDATE ak_web_user_sec_attr_values
SET number_value = p_new_vendor_id
WHERE attribute_code = 'ICX_SUPPLIER_ORG_ID'
AND attribute_application_id = 177
AND number_value = p_old_vendor_id;
UPDATE fnd_registration_details
SET field_value_string = (SELECT vendor_name FROM po_vendors WHERE vendor_id = p_new_vendor_id)
WHERE field_name = 'Supplier Name'
AND registration_id IN
(SELECT DISTINCT registration_id
FROM fnd_registration_details WHERE field_name = 'Supplier Number'
AND field_value_number = p_old_vendor_id
);
UPDATE fnd_registration_details
SET field_value_number = p_new_vendor_id
WHERE field_name = 'Supplier Number'
AND registration_id IN
(SELECT DISTINCT registration_id
FROM fnd_registration_details WHERE field_name = 'Supplier Number'
AND field_value_number = p_old_vendor_id
);
UPDATE pos_acct_addr_rel
SET vendor_id = p_new_vendor_id,
last_update_date = SYSDATE,
last_updated_by = FND_GLOBAL.user_id,
last_update_login = FND_GLOBAL.login_id
WHERE vendor_id = p_old_vendor_id;
UPDATE pos_supplier_mappings
SET vendor_id = p_new_vendor_id,
last_update_date = SYSDATE,
last_updated_by = FND_GLOBAL.user_id,
last_update_login = FND_GLOBAL.login_id
WHERE vendor_id = p_old_vendor_id;
UPDATE pos_supplier_registrations
SET po_vendor_id = p_new_vendor_id,
last_update_date = SYSDATE,
last_updated_by = FND_GLOBAL.user_id,
last_update_login = FND_GLOBAL.login_id
WHERE po_vendor_id = p_old_vendor_id;
UPDATE pos_sup_bank_account_requests
SET vendor_id = p_new_vendor_id,
last_update_date = SYSDATE,
last_updated_by = FND_GLOBAL.user_id,
last_update_login = FND_GLOBAL.login_id
WHERE vendor_id = p_old_vendor_id;
-- delete classifications of the merged-from vendor that
-- the merged-to vendor also has
DELETE pos_sup_products_services t1
WHERE vendor_id = p_old_vendor_id
AND exists
(SELECT 1 FROM pos_sup_products_services t2
WHERE (t1.segment1 = t2.segment1 OR t1.segment1 IS NULL AND t2.segment1 IS NULL)
AND (t1.segment2 = t2.segment2 OR t1.segment2 IS NULL AND t2.segment2 IS NULL)
AND (t1.segment3 = t2.segment3 OR t1.segment3 IS NULL AND t2.segment3 IS NULL)
AND (t1.segment4 = t2.segment4 OR t1.segment4 IS NULL AND t2.segment4 IS NULL)
AND (t1.segment5 = t2.segment5 OR t1.segment5 IS NULL AND t2.segment5 IS NULL)
AND (t1.segment6 = t2.segment6 OR t1.segment6 IS NULL AND t2.segment6 IS NULL)
AND (t1.segment7 = t2.segment7 OR t1.segment7 IS NULL AND t2.segment7 IS NULL)
AND (t1.segment8 = t2.segment8 OR t1.segment8 IS NULL AND t2.segment8 IS NULL)
AND (t1.segment9 = t2.segment9 OR t1.segment9 IS NULL AND t2.segment9 IS NULL)
AND (t1.segment10 = t2.segment10 OR t1.segment10 IS NULL AND t2.segment10 IS NULL)
AND (t1.segment11 = t2.segment11 OR t1.segment11 IS NULL AND t2.segment11 IS NULL)
AND (t1.segment12 = t2.segment12 OR t1.segment12 IS NULL AND t2.segment12 IS NULL)
AND (t1.segment13 = t2.segment13 OR t1.segment13 IS NULL AND t2.segment13 IS NULL)
AND (t1.segment14 = t2.segment14 OR t1.segment14 IS NULL AND t2.segment14 IS NULL)
AND (t1.segment15 = t2.segment15 OR t1.segment15 IS NULL AND t2.segment15 IS NULL)
AND (t1.segment16 = t2.segment16 OR t1.segment16 IS NULL AND t2.segment16 IS NULL)
AND (t1.segment17 = t2.segment17 OR t1.segment17 IS NULL AND t2.segment17 IS NULL)
AND (t1.segment18 = t2.segment18 OR t1.segment18 IS NULL AND t2.segment18 IS NULL)
AND (t1.segment19 = t2.segment19 OR t1.segment19 IS NULL AND t2.segment19 IS NULL)
AND (t1.segment20 = t2.segment20 OR t1.segment20 IS NULL AND t2.segment20 IS NULL)
AND t2.vendor_id = p_new_vendor_id);
UPDATE pos_sup_products_services
SET vendor_id = p_new_vendor_id,
last_update_date = SYSDATE,
last_updated_by = FND_GLOBAL.user_id,
last_update_login = FND_GLOBAL.login_id
WHERE vendor_id = p_old_vendor_id;
SELECT count(*)
INTO l_num_active_sites
FROM po_vendor_sites_all
WHERE vendor_id = p_dup_vendor_id
AND vendor_site_id <> p_dup_vendor_site_id
AND nvl(inactive_date, sysdate+1) > sysdate;