The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT po_header_id,release_num
INTO l_po_header_id, l_po_rel_num
FROM po_releases_archive_all
WHERE po_release_id = l_po_rel_id
AND revision_num = l_po_rel_rev_num;
SELECT 'YES'
INTO l_osp_item_exists
FROM po_lines_archive_all
WHERE po_header_id = l_po_header_id
AND line_type_id IN
( SELECT line_type_id
FROM po_line_types
WHERE outside_operation_flag ='Y'
)
AND ROWNUM < 2;
SELECT vendor_id,vendor_site_id,org_id,revision_num
INTO l_party_id,l_party_site_id,l_org_id,l_po_rev_num
FROM po_headers_archive_all
WHERE po_header_id = l_po_header_id
AND latest_external_flag = 'Y';
SELECT vendor_id,vendor_site_id,org_id,revision_num
INTO l_party_id,l_party_site_id,l_org_id,l_po_rev_num
FROM po_headers_archive_all
WHERE po_header_id = l_po_header_id
AND revision_num = l_po_rev_num;
SELECT l.po_header_id,ll.po_line_id,ll.line_location_id,d.PO_DISTRIBUTION_ID
FROM po_lines_all l, po_line_locations_all ll, po_distributions_all d
WHERE l.po_header_id = l_po_header_id
AND l.line_type_id IN (
SELECT line_type_id
FROM po_line_types
WHERE outside_operation_flag ='Y'
)
AND ll.po_line_id = l.po_line_id
AND (ll.po_release_id = l_po_rel_id OR ll.po_release_id IS NULL)
AND d.line_location_id = ll.line_location_id;
SELECT revised_date,creation_date
INTO l_rev_date,l_creation_date
FROM po_releases_archive_all
WHERE po_release_id = l_po_rel_id
AND revision_num = l_po_rel_rev_num;
SELECT cancel_flag
INTO l_cancel_flag
FROM po_releases_all
WHERE po_release_id = l_po_rel_id;
SELECT creation_date,revised_date,cancel_flag
INTO l_creation_date,l_rev_date,l_cancel_flag
FROM po_headers_archive_all
WHERE po_header_id = l_po_header_id
AND ((revision_num = l_po_rev_num) OR (revision_num IS NULL));
SELECT 'x'
INTO l_lines_loc_chk
FROM po_line_locations_archive_all
WHERE po_header_id = l_po_header_id
AND revision_num = l_po_rev_num_x
AND po_line_id = lines_rec.po_line_id
AND line_location_id = lines_rec.line_location_id
AND cancel_flag = 'Y';
SELECT COUNT(*)
INTO l_lines_chk
FROM dual
WHERE EXISTS ( (
SELECT po_header_id
FROM po_lines_archive_all
WHERE po_header_id = l_po_header_id
AND po_line_id = lines_rec.po_line_id
AND revision_num = l_po_rev_num_x
)
UNION
(
SELECT po_header_id
FROM po_line_locations_archive_all
WHERE po_header_id = l_po_header_id
AND revision_num = l_po_rev_num_x
AND po_line_id = lines_rec.po_line_id
AND line_location_id = lines_rec.line_location_id
)
UNION
(
SELECT po_header_id
FROM po_distributions_archive_all
WHERE po_header_id = l_po_header_id
AND revision_num = l_po_rev_num_x
AND po_line_id = lines_rec.po_line_id
AND po_distribution_id = lines_rec.po_distribution_id
)
);
SELECT revision_num,vendor_product_num,item_revision,unit_meas_lookup_code
INTO l_line_rev_num,l_item,l_item_rv,l_uom
FROM po_lines_archive_all
WHERE po_header_id = l_po_header_id
AND po_line_id = lines_rec.po_line_id
AND latest_external_flag = 'Y';
SELECT line_location_id,revision_num
INTO l_line_loc_id,l_line_loc_rev_num
FROM po_line_locations_archive_all
WHERE po_header_id = l_po_header_id
AND po_line_id = lines_rec.po_line_id
AND line_location_id = lines_rec.line_location_id
AND ((po_release_id = l_po_rel_id) OR (po_release_id IS NULL))
AND latest_external_flag = 'Y'
AND revision_num = (
SELECT MAX(revision_num)
FROM po_line_locations_archive_all
WHERE po_header_id = l_po_header_id
AND po_line_id = lines_rec.po_line_id
AND line_location_id = lines_rec.line_location_id
AND ((po_release_id = l_po_rel_id) OR (po_release_id IS NULL))
);
SELECT WIP_ENTITY_ID,WIP_OPERATION_SEQ_NUM,DESTINATION_ORGANIZATION_ID,(QUANTITY_ORDERED-QUANTITY_CANCELLED)
INTO l_wip_entity_id,l_rout_seq_num,l_osfm_org_id,l_dist_quant_ord
FROM PO_DISTRIBUTIONS_ALL
WHERE po_header_id = l_po_header_id
AND po_line_id = lines_rec.po_line_id
AND ((po_release_id = l_po_rel_id) OR (po_release_id IS NULL))
AND line_location_id = l_line_loc_id
AND po_distribution_id = lines_rec.po_distribution_id;
SELECT wip_entity_name,item_number
INTO l_job_num,l_assembly_name
FROM WSM_WIP_GENEALOGY_V
WHERE WIP_ENTITY_ID = l_wip_entity_id
AND organization_id = l_osfm_org_id;
SELECT M4R_7B5_OSFM_S1.NEXTVAL
INTO l_doc_id
FROM dual;
SELECT description
INTO l_op_desc
FROM wip_operations
WHERE wip_entity_id = l_wip_entity_id
AND operation_seq_num = l_rout_seq_num;
SELECT f.ship_to_location_id,t.ship_to_location_id,
f.bill_to_location_id,t.bill_to_location_id,
f.terms_id,t.terms_id,
f.ship_via_lookup_code,t.ship_via_lookup_code,
f.fob_lookup_code,t.fob_lookup_code,
f.vendor_site_id,t.vendor_site_id,
f.amount_limit,t.amount_limit,
f.start_date,t.start_date,
f.end_date,t.end_date
INTO l_from_ship_to_location_id,l_to_ship_to_location_id,
l_from_bill_to_location_id,l_to_bill_to_location_id,
l_from_terms_id,l_to_terms_id,
l_from_ship_via_lookup_code,l_to_ship_via_lookup_code,
l_from_fob_lookup_code,l_to_fob_lookup_code,
l_from_vendor_site_id,l_to_vendor_site_id,
l_from_amount_limit,l_to_amount_limit,
l_from_start_date,l_to_start_date,
l_from_end_date,l_to_end_date
FROM po_headers_archive_all f, po_headers_archive_all t
WHERE f.po_header_id = p_header_id
AND f.revision_num = p_revision_num
AND t.po_header_id = p_header_id
AND t.revision_num = p_revision_num-1;
SELECT f.release_num ,t.release_num
INTO l_from_rel_num,l_to_rel_num
FROM po_releases_archive_all f,po_releases_archive_all t
WHERE f.po_release_id = p_release_id
AND f.revision_num = p_revision_num
AND t.po_release_id = p_release_id
AND t.revision_num = p_revision_num-1;