The following lines contain the word 'select', 'insert', 'update' or 'delete':
procedure insert_instance(p_wip_entity_id in number,
p_operation_seq_num in number,
p_resource_seq_num in number,
p_organization_id in number,
p_user_id in number,
p_instance_id in number,
p_start_date in date,
p_completion_date in date,
p_assigned_units_updated out NOCOPY number) is
l_start_date DATE;
p_assigned_units_updated := 0;
select distinct start_date, completion_date, organization_id into l_start_date, l_completion_date, l_org_id
from wip_operation_resources wor
where wor.wip_entity_id = p_wip_entity_id
and wor.operation_seq_num = p_operation_seq_num
and wor.resource_seq_num = p_resource_seq_num;
INSERT INTO WIP_OP_RESOURCE_INSTANCES
(
WIP_ENTITY_ID,
OPERATION_SEQ_NUM,
RESOURCE_SEQ_NUM,
ORGANIZATION_ID,
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
INSTANCE_ID,
START_DATE,
COMPLETION_DATE)
VALUES(
p_wip_entity_id,
p_operation_seq_num,
p_resource_seq_num,
l_org_id,
sysdate,
l_user_id,
sysdate,
l_user_id,
p_instance_id,
l_start_date,
l_completion_date);
p_assigned_units_updated := p_assigned_units_updated + 1 ;
end insert_instance;
select count(*) into l_num
from WIP_OP_RESOURCE_INSTANCES
where wip_entity_id = p_wip_entity_id and
operation_seq_num = p_operation_seq_num and
resource_seq_num = p_resource_seq_num and
instance_id = p_instance_id;
select count(*) into l_instance_num
from WIP_OP_RESOURCE_INSTANCES
where wip_entity_id = p_wip_entity_id and
operation_seq_num = p_operation_seq_num and
resource_seq_num = p_resource_seq_num;
select nvl(assigned_units,0) into l_assigned_units_num
from WIP_OPERATION_RESOURCES
where wip_entity_id = p_wip_entity_id and
operation_seq_num = p_operation_seq_num and
resource_seq_num = p_resource_seq_num;
update wip_operation_resources
set assigned_units = (l_instance_num + 1)
where wip_entity_id = p_wip_entity_id and
operation_seq_num = p_operation_seq_num and
resource_seq_num = p_resource_seq_num;
update wip_discrete_jobs
set firm_planned_flag = 1
where wip_entity_id = p_wip_entity_id;
delete from wip_op_resource_instances
where wip_entity_id = p_wip_entity_id and
operation_seq_num = p_operation_seq_num and
resource_seq_num = p_resource_seq_num and
instance_id = p_instance_id;