The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT PO_DISTRIBUTION_ID, 1,ceil(rownum/p_batch_size)
FROM (SELECT pod.PO_DISTRIBUTION_ID,pol.item_id,pod.creation_date
FROM po_lines_all pol,
po_line_locations_all pll,
po_headers_all poh,
po_distributions_all pod
WHERE pod.line_location_id = pll.line_location_id
and pod.po_line_id = pol.po_line_id
and pod.po_header_id = poh.po_header_id
and pll.shipment_type = 'STANDARD'
and pll.approved_flag = 'Y'
and nvl(pod.distribution_type,'-99') <> 'AGREEMENT'
and greatest(pol.last_update_date, pll.last_update_date,
poh.last_update_date, pod.last_update_date, nvl(pod.program_update_date, pod.last_update_date))
between p_start_date and p_end_date
UNION ALL
SELECT pod.PO_DISTRIBUTION_ID,pol.item_id,pod.creation_date
FROM po_lines_all pol,
po_line_locations_all pll,
po_headers_all poh,
po_releases_all por,
po_distributions_all pod
WHERE pod.line_location_id = pll.line_location_id
and pod.po_release_id = por.po_release_id
and pod.po_line_id = pol.po_line_id
and pod.po_header_id = poh.po_header_id
and pll.shipment_type in ('BLANKET', 'SCHEDULED')
and pll.approved_flag = 'Y'
and nvl(pod.distribution_type,'-99') <> 'AGREEMENT'
and greatest(pol.last_update_date,pll.last_update_date,
poh.last_update_date,por.last_update_date,pod.last_update_date, nvl(pod.program_update_date, pod.last_update_date))
between p_start_date and p_end_date)
order by item_id,creation_date;
select sysdate into l_start_time from dual;
/* l_primary_key.delete; l_seq_id.delete; l_batch_id.delete; */
INSERT INTO poa_edw_po_dist_inc (primary_key, seq_id,batch_id) values(l_primary_key(i),l_seq_id(i),l_batch_id(i));
select sysdate into l_end_time from dual;
delete from poa_bis_savings_rpt
where last_update_date <= sysdate - 2;
select max(batch_id) into l_no_batch from poa_edw_po_dist_inc;
SELECT sysdate INTO v_start_time from sys.dual;
select sysdate into l_end_time from dual;
SELECT distinct pod.code_combination_id
, pod.set_of_books_id
FROM po_distributions_all pod
where pod.po_distribution_id IN
(SELECT distinct poa.distribution_transaction_id
FROM poa_bis_savings poa);
UPDATE poa_bis_savings poa
set cost_center_id = v_cost_center_id,
account_id = v_account_id,
company_id = v_company_id
WHERE poa.distribution_transaction_id IN
(SELECT pod.po_distribution_id
FROM po_distributions_all pod
WHERE pod.code_combination_id = v_ccid
and pod.set_of_books_id = v_set_of_books_id);