The following lines contain the word 'select', 'insert', 'update' or 'delete':
select rowid
from cs_estimate_details
where p_from_fk_id in (bill_to_contact_id, ship_to_contact_id,
bill_to_party_id, ship_to_party_id )
for update nowait;
select merge_reason_code
into l_merge_reason_code
from hz_merge_batch
where batch_id = p_batch_id;
update cs_estimate_details
set bill_to_contact_id = decode(bill_to_contact_id, p_from_fk_id, p_to_fk_id, bill_to_contact_id),
ship_to_contact_id = decode(ship_to_contact_id, p_from_fk_id, p_to_fk_id, ship_to_contact_id),
bill_to_party_id = decode(bill_to_party_id, p_from_fk_id, p_to_fk_id, bill_to_party_id),
ship_to_party_id = decode(ship_to_party_id, p_from_fk_id, p_to_fk_id, ship_to_party_id),
object_version_number = object_version_number + 1,
last_update_date = SYSDATE,
last_updated_by = G_USER_ID,
last_update_login = G_LOGIN_ID
where rowid = l_rowid_tbl(i);
arp_message.set_name('AR', 'AR_ROWS_UPDATED');
select rowid
from cs_estimate_details
where p_from_fk_id in (invoice_to_org_id, ship_to_org_id)
for update nowait;
select merge_reason_code
into l_merge_reason_code
from hz_merge_batch
where batch_id = p_batch_id;
-- obtain lock on records to be updated.
arp_message.set_name('AR', 'AR_LOCKING_TABLE');
update cs_estimate_details
set invoice_to_org_id = decode(invoice_to_org_id, p_from_fk_id, p_to_fk_id, invoice_to_org_id),
ship_to_org_id = decode(ship_to_org_id,p_from_fk_id,p_to_fk_id,ship_to_org_id),
last_update_date = SYSDATE,
last_updated_by = G_USER_ID,
last_update_login = G_LOGIN_ID
where estimate_detail_id = p_from_id;
update cs_estimate_details
set invoice_to_org_id = decode(invoice_to_org_id, p_from_fk_id, p_to_fk_id, invoice_to_org_id),
ship_to_org_id = decode(ship_to_org_id,p_from_fk_id,p_to_fk_id,ship_to_org_id),
last_update_date = SYSDATE,
last_updated_by = G_USER_ID,
last_update_login = G_LOGIN_ID
where rowid = l_rowid_tbl(i);
arp_message.set_name('AR', 'AR_ROWS_UPDATED');
select rowid
from cs_chg_sub_restrictions
where value_object_id = p_from_fk_id
and restriction_type = 'BILL_TO_CUSTOMER'
for update nowait;
select restriction_id, value_object_id
from cs_chg_sub_restrictions
where restriction_type = 'BILL_TO_CUSTOMER'
and end_date_active IS NULL;
select merge_reason_code
into l_merge_reason_code
from hz_merge_batch
where batch_id = p_batch_id;
update cs_chg_sub_restrictions
set value_object_id = decode(value_object_id, p_from_fk_id, p_to_fk_id,value_object_id),
object_version_number = object_version_number + 1,
last_update_date = SYSDATE,
last_updated_by = G_USER_ID,
last_update_login = G_LOGIN_ID
where rowid = l_rowid_tbl(i);
arp_message.set_name('AR', 'AR_ROWS_UPDATED');
update cs_chg_sub_restrictions
set end_date_active = SYSDATE - 1
where restriction_id = l_from_restriction_id;