The following lines contain the word 'select', 'insert', 'update' or 'delete':
select header_id
from so_headers
where ship_to_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
for update nowait;
select header_id
from so_headers
where invoice_to_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
for update nowait;
select header_id
from so_headers
where customer_id in (select m.duplicate_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
for update nowait;
/* site level update */
arp_message.set_name( 'AR', 'AR_UPDATING_TABLE');
UPDATE SO_HEADERS a
set (ship_to_site_use_id) = (select distinct m.customer_site_id
from ra_customer_merges m
where a.ship_to_site_use_id =
m.duplicate_site_id
and m.request_id = req_id
and m.process_flag = 'N'
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login,
request_id = req_id,
program_application_id =arp_standard.profile.program_application_id,
program_id = arp_standard.profile.program_id,
program_update_date = sysdate
where ship_to_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num);
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );
UPDATE SO_HEADERS a
set (invoice_to_site_use_id) = (select distinct m.customer_site_id
from ra_customer_merges m
where a.invoice_to_site_use_id =
m.duplicate_site_id
and m.request_id = req_id
and m.process_flag = 'N'
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login,
request_id = req_id,
program_application_id =arp_standard.profile.program_application_id,
program_id = arp_standard.profile.program_id,
program_update_date = sysdate
where invoice_to_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num);
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );
/* customer level update */
arp_message.set_name( 'AR', 'AR_UPDATING_TABLE');
UPDATE SO_HEADERS a
set customer_id = (select distinct m.customer_id
from ra_customer_merges m
where a.customer_id =
m.duplicate_id
and m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login,
request_id = req_id,
program_application_id =arp_standard.profile.program_application_id,
program_id = arp_standard.profile.program_id,
program_update_date = sysdate
where customer_id in (select m.duplicate_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num);
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );
select line_id
from so_lines
where ship_to_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
for update nowait;
/* site level update */
arp_message.set_name( 'AR', 'AR_UPDATING_TABLE');
UPDATE SO_LINES a
set (ship_to_site_use_id) = (select distinct m.customer_site_id
from ra_customer_merges m
where a.ship_to_site_use_id =
m.duplicate_site_id
and m.request_id = req_id
and m.process_flag = 'N'
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login,
request_id = req_id,
program_application_id =arp_standard.profile.program_application_id,
program_id = arp_standard.profile.program_id,
program_update_date = sysdate
where ship_to_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num);
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );
select line_service_detail_id
from so_line_service_details
where installation_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
for update nowait;
/* site level update */
arp_message.set_name( 'AR', 'AR_UPDATING_TABLE');
UPDATE SO_LINE_SERVICE_DETAILS a
set (installation_site_use_id) = (select distinct m.customer_site_id
from ra_customer_merges m
where a.installation_site_use_id =
m.duplicate_site_id
and m.request_id = req_id
and m.process_flag = 'N'
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login
where installation_site_use_id in (select m.duplicate_site_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num);
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );
select order_approval_id
from so_order_approvals
where customer_id in (select m.duplicate_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
for update nowait;
/* customer level update */
arp_message.set_name( 'AR', 'AR_UPDATING_TABLE');
UPDATE SO_ORDER_APPROVALS a
set customer_id = (select distinct m.customer_id
from ra_customer_merges m
where a.customer_id =
m.duplicate_id
and m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login
where customer_id in (select m.duplicate_id
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num);
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );
select standard_value_rule_id
from so_standard_value_rules
where attribute_value in (select to_char(m.duplicate_site_id)
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
and standard_value_source_id = 1
and attribute_id = 10026
for update nowait;
select standard_value_rule_id
from so_standard_value_rules
where attribute_value in (select to_char(m.duplicate_site_id)
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
and standard_value_source_id = 1
and attribute_id = 10028
for update nowait;
/* site level update */
arp_message.set_name( 'AR', 'AR_UPDATING_TABLE');
UPDATE SO_STANDARD_VALUE_RULES a
set attribute_value = (select distinct to_char(m.customer_site_id)
from ra_customer_merges m
where a.attribute_value =
to_char(m.duplicate_site_id)
and m.request_id = req_id
and m.process_flag = 'N'
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login
where attribute_value in (select to_char(m.duplicate_site_id)
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
and standard_value_source_id = 1
and attribute_id = 10026;
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );
/* site level update */
arp_message.set_name( 'AR', 'AR_UPDATING_TABLE');
UPDATE SO_STANDARD_VALUE_RULES a
set attribute_value = (select distinct to_char(m.customer_site_id)
from ra_customer_merges m
where a.attribute_value =
to_char(m.duplicate_site_id)
and m.request_id = req_id
and m.process_flag = 'N'
and m.set_number = set_num),
last_update_date = sysdate,
last_updated_by = arp_standard.profile.user_id,
last_update_login = arp_standard.profile.last_update_login
where attribute_value in (select to_char(m.duplicate_site_id)
from ra_customer_merges m
where m.process_flag = 'N'
and m.request_id = req_id
and m.set_number = set_num)
and standard_value_source_id = 1
and attribute_id = 10028;
arp_message.set_name( 'AR', 'AR_ROWS_UPDATED' );