The following lines contain the word 'select', 'insert', 'update' or 'delete':
l_stmt := 'SELECT primary_item_id,
wip_entity_id,
organization_id,
completion_subinventory,
completion_locator_id,
alternate_routing_designator,
project_id,
task_id,
planned_quantity-NVL(quantity_completed,0)-NVL(quantity_scrapped,0)
FROM wip_flow_schedules wfs
WHERE (planned_quantity - NVL(quantity_completed,0) -
NVL(quantity_scrapped,0)) > 0
AND status = 1
and ( wfs.demand_source_header_id is null or
exists ( select 1 from wip_open_demands_v wodv
where to_char(wodv.demand_source_line_id) = wfs.demand_source_line
and wodv.demand_source_header_id = wfs.demand_source_header_id)
) ';
select location_control_code,
restrict_locators_code, restrict_subinventories_code,
serial_number_control_code, lot_control_code
into l_item_locator_control,
l_restrict_loc, l_restrict_sub,
l_serial_control, l_lot_control
from mtl_system_items
where inventory_item_id = l_primary_item_id
and organization_id = l_org_id;
select count(*)
into l_cnt
from mtl_item_sub_ast_trk_val_v
where organization_id = l_org_id
and inventory_item_id = l_primary_item_id
and secondary_inventory_name = l_completion_subinventory;
select locator_type
into l_sub_locator_control
from mtl_secondary_inventories
where organization_id = l_org_id
and secondary_inventory_name = l_completion_subinventory;
select count(*)
into l_cnt
from mtl_secondary_locators
where inventory_item_id = l_primary_item_id
and organization_id = l_org_id
and subinventory_code = l_completion_subinventory
and secondary_locator = l_completion_locator;