The following lines contain the word 'select', 'insert', 'update' or 'delete':
select 1
from jtf_ih_interactions
where party_id = p_from_fk_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');
select party_type into s_Party_Type from hz_parties where party_id = p_to_fk_id;
update jtf_ih_interactions
-- set party_id = decode(party_id, p_to_fk_id, p_to_fk_id, party_id),
set party_id = p_to_fk_id,
last_update_date = hz_utility_pub.last_update_date,
last_updated_by = hz_utility_pub.user_id,
last_update_login = hz_utility_pub.last_update_login,
-- Enh# 1846960
-- If Primary_Party_Id equals Party_Id then update it to new value.
primary_party_id = decode(primary_party_id, party_id, p_to_fk_id,primary_party_id),
-- If Contact_Party_Id equals Primary_Party_ID and Primary_Party_ID is going to be
-- not a person, then update Contact_Party_ID to NULL
contact_party_id = decode(nvl(contact_party_id,-1),-1,NULL,
decode(contact_party_id,primary_party_id,
(decode(s_Party_Type,'PERSON',p_to_fk_id,NULL)), contact_party_id)),
request_id = hz_utility_pub.request_id,
program_application_id = hz_utility_pub.program_application_id,
program_id = hz_utility_pub.program_id,
program_update_date = sysdate,
object_version_number = object_version_number + 1 -- Bug# 2295015
-- where interaction_id = p_from_id;
arp_message.set_name('AR', 'AR_ROWS_UPDATED');
update jtf_ih_activities
set doc_id = p_to_fk_id
where doc_id = p_from_fk_id
and doc_ref IN (
select object_code
from jtf_objects_b
where from_table = 'HZ_PARTIES'
);