The following lines contain the word 'select', 'insert', 'update' or 'delete':
current_forecasts.DELETE(p_pm_forecast_id);
current_forecasts_index.delete(current_forecasts_index2(p_pm_forecast_id));
current_forecasts_index2.DELETE(p_pm_forecast_id);
current_forecasts_index.delete;
SELECT meaa.asset_activity_id, fw.pm_schedule_id, fw.action_type,
fw.wip_entity_id, fw.wo_status, ewsv.system_status, fw.cycle_id, fw.seq_id,
meaa.maintenance_object_type, meaa.maintenance_object_id,
msi.inventory_item_id, msi.eam_item_type, fw.scheduled_start_date,
fw.scheduled_completion_date, fw.organization_id organization_id,
fw.pm_base_meter_reading
from eam_forecasted_work_orders fw, mtl_eam_asset_activities meaa,
eam_wo_statuses_v ewsv, csi_item_instances cii, mtl_system_items_b msi
where PM_FORECAST_ID = l_forecast_id and
fw.activity_association_id = meaa.activity_association_id and
ewsv.status_id=fw.wo_status and meaa.maintenance_object_type = 3 and
meaa.maintenance_object_id = cii.instance_id and cii.inventory_item_id =
msi.inventory_item_id and cii.last_vld_organization_id = msi.organization_id
union all
SELECT meaa.asset_activity_id, fw.pm_schedule_id, fw.action_type,
fw.wip_entity_id, fw.wo_status, ewsv.system_status, fw.cycle_id, fw.seq_id,
meaa.maintenance_object_type, meaa.maintenance_object_id,
meaa.maintenance_object_id, 3, fw.scheduled_start_date,
fw.scheduled_completion_date, fw.organization_id organization_id,
fw.pm_base_meter_reading
from eam_forecasted_work_orders fw, mtl_eam_asset_activities meaa,
eam_wo_statuses_v ewsv
where PM_FORECAST_ID = l_forecast_id and fw.activity_association_id =
meaa.activity_association_id and ewsv.status_id=fw.wo_status and
meaa.maintenance_object_type = 2 ;
l_eam_wo_tbl.delete;
l_eam_wo_relations_tbl.delete;
fnd_message.set_name('EAM', 'EAM_FORECAST_DELETED');
select decode(eps.RESCHEDULING_POINT,6,epr.meter_id ,null) into l_base_meter_id
from eam_pm_schedulings eps,eam_pm_scheduling_rules epr where
eps.pm_schedule_id = epr.pm_schedule_id and rownum = 1
and eps.pm_schedule_id = sugg_rec.pm_schedule_id;
l_eam_wo_tbl(i).transaction_type := eam_process_wo_pub.G_OPR_UPDATE;
l_eam_wo_tbl(i).transaction_type := eam_process_wo_pub.G_OPR_UPDATE;
fnd_message.set_name('EAM', 'EAM_FORECAST_DELETED');
SELECT meaa.asset_activity_id, fw.pm_schedule_id, fw.action_type,
fw.wip_entity_id, fw.wo_status, ewsv.system_status, fw.cycle_id, fw.seq_id,
meaa.maintenance_object_type, meaa.maintenance_object_id,
msi.inventory_item_id, msi.eam_item_type, fw.scheduled_start_date,
fw.scheduled_completion_date, fw.organization_id organization_id,
fw.pm_base_meter_reading
from eam_forecasted_work_orders fw, mtl_eam_asset_activities meaa,
eam_wo_statuses_v ewsv, csi_item_instances cii, mtl_system_items_b msi
where group_id = l_group_id and
fw.activity_association_id = meaa.activity_association_id and
ewsv.status_id=fw.wo_status and meaa.maintenance_object_type = 3 and
meaa.maintenance_object_id = cii.instance_id and cii.inventory_item_id =
msi.inventory_item_id and cii.last_vld_organization_id = msi.organization_id
union all
SELECT meaa.asset_activity_id, fw.pm_schedule_id, fw.action_type,
fw.wip_entity_id, fw.wo_status, ewsv.system_status, fw.cycle_id, fw.seq_id,
meaa.maintenance_object_type, meaa.maintenance_object_id,
meaa.maintenance_object_id, 3, fw.scheduled_start_date,
fw.scheduled_completion_date, fw.organization_id organization_id,
fw.pm_base_meter_reading
from eam_forecasted_work_orders fw, mtl_eam_asset_activities meaa,
eam_wo_statuses_v ewsv
where group_id = l_group_id and fw.activity_association_id =
meaa.activity_association_id and ewsv.status_id=fw.wo_status and
meaa.maintenance_object_type = 2 ;
l_eam_wo_tbl.delete;
l_eam_wo_relations_tbl.delete;
SELECT PROCESS_FLAG
from eam_forecasted_work_orders
where PM_FORECAST_ID = l_forecast_id
for update of process_flag nowait;
fnd_message.set_name('EAM', 'EAM_FORECAST_DELETED');
update eam_forecasted_work_orders
set process_flag = 'Y'
where pm_forecast_id = l_forecast_id;
delete from eam_forecasted_work_orders
where group_id = p_group_id and
process_flag = 'N';
work_orders_not_ready.DELETE(p_wip_entity_id);
work_orders_released.DELETE(p_wip_entity_id);
work_orders_unreleased.DELETE(p_wip_entity_id);
select scheduled_start_date,scheduled_completion_date into l_sheduled_start_date,l_scheduled_completion_date
from wip_discrete_jobs where wip_entity_id = l_wip_entity_id;
l_eam_wo_rec.transaction_type := EAM_PROCESS_WO_PUB.G_OPR_UPDATE;
l_eam_wo_rec_1.transaction_type := EAM_PROCESS_WO_PUB.G_OPR_UPDATE;
select fwo.cycle_id,fwo.seq_id,eps.maintenance_object_id,eps.maintenance_object_type
from eam_forecasted_work_orders fwo,eam_pm_schedulings eps
where fwo.pm_schedule_id=eps.pm_schedule_id and fwo.pm_forecast_id in (
( select * from table( cast ( current_forecasts_index as system.eam_wipid_tab_type
)
)
) )
and action_type <>3 and action_type <> 4 order by maintenance_object_id,maintenance_object_type,cycle_id desc,seq_id desc
)
loop
l_cycle_id := c1.cycle_id;
select count(1) into l_cnt from
eam_forecasted_work_orders fwo,eam_pm_schedulings eps
where fwo.pm_schedule_id = eps.pm_schedule_id and group_id = p_pm_group_id
and (cycle_id >0 and seq_id >0 and (( cycle_id=l_cycle_id and seq_id <= l_seq_id) or cycle_id < l_cycle_id ))
and action_type NOT IN(3,4) and maintenance_object_id =l_maint_id and maintenance_object_type = l_maint_type;
delete from eam_forecasted_work_orders
where PM_FORECAST_ID = l_forecast_id;