The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM = X_Resource_Seq_Num;
SELECT count(*)
FROM WIP_SUB_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM = X_Resource_Seq_Num;
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM = X_Resource_Seq_Num
AND REPETITIVE_SCHEDULE_ID = X_Repetitive_Schedule_Id;
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM <> X_Resource_Seq_Num
AND AUTOCHARGE_TYPE = 4;
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND REPETITIVE_SCHEDULE_ID = X_Repetitive_Schedule_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM <> X_Resource_Seq_Num
AND AUTOCHARGE_TYPE = 4;
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM <> X_Resource_Seq_Num
AND SCHEDULED_FLAG = 3;
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND REPETITIVE_SCHEDULE_ID = X_Repetitive_Schedule_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM <> X_Resource_Seq_Num
AND SCHEDULED_FLAG = 3;
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM <> X_Resource_Seq_Num
AND SCHEDULED_FLAG = 4;
SELECT count(*)
FROM WIP_OPERATION_RESOURCES
WHERE ORGANIZATION_ID = X_Organization_Id
AND WIP_ENTITY_ID = X_Wip_Entity_Id
AND REPETITIVE_SCHEDULE_ID = X_Repetitive_Schedule_Id
AND OPERATION_SEQ_NUM = X_Operation_Seq_Num
AND RESOURCE_SEQ_NUM <> X_Resource_Seq_Num
AND SCHEDULED_FLAG = 4;
select 1
from wip_cost_txn_interface
where organization_id = X_Organization_Id
and wip_entity_id = X_Wip_Entity_Id
and operation_seq_num = X_Operation_Seq_Num
and resource_seq_num = X_Resource_Seq_Num;
select 1
from wip_transactions
where organization_id = X_Organization_Id
and wip_entity_id = X_Wip_Entity_Id
and operation_seq_num = X_Operation_Seq_Num
and resource_seq_num = X_Resource_Seq_Num;
select 1
from wip_cost_txn_interface
where organization_id = X_Organization_Id
and wip_entity_id = X_Wip_Entity_Id
and operation_seq_num = X_Operation_Seq_Num
and resource_seq_num = X_Resource_Seq_Num
and line_id = X_Line_Id;
select 1
from wip_transactions
where organization_id = X_Organization_Id
and wip_entity_id = X_Wip_Entity_Id
and operation_seq_num = X_Operation_Seq_Num
and resource_seq_num = X_Resource_Seq_Num
and line_id = X_Line_Id;
UPDATE wip_operation_resources
SET start_date = X_First_Unit_Start_Date,
completion_date = X_Last_Unit_Completion_Date
WHERE wip_entity_id = X_Wip_Entity_Id
AND organization_id = X_Organization_Id
AND operation_seq_num = X_Operation_Seq_Num
AND resource_seq_num = X_Resource_Seq_Num;
UPDATE wip_operation_resources
SET start_date = X_First_Unit_Start_Date,
completion_date = X_Last_Unit_Completion_Date
WHERE wip_entity_id = X_Wip_Entity_Id
AND organization_id = X_Organization_Id
AND operation_seq_num = X_Operation_Seq_Num
AND resource_seq_num = X_Resource_Seq_Num
AND repetitive_schedule_id = X_Repetitive_Schedule_Id;
SELECT UOM_CLASS
FROM MTL_UOM_CONVERSIONS CON
WHERE CON.UOM_CODE = X_Unit
AND CON.INVENTORY_ITEM_ID = 0;
Procedure delete_orphaned_alternates (p_wip_entity_id in number,
p_schedule_id in number,
x_return_status out nocopy varchar2) is
begin
x_return_status := fnd_api.g_ret_sts_success;
delete from wip_sub_operation_resources wsor
where wip_entity_id = p_wip_entity_id
and nvl(repetitive_schedule_id, -1) = nvl(p_schedule_id, -1)
and not exists (select 1
from wip_operation_resources wor
where wor.wip_entity_id = p_wip_entity_id
and nvl(wor.repetitive_schedule_id, -1) = nvl(p_schedule_id, -1)
and wor.operation_seq_num = wsor.operation_seq_num
and wor.substitute_group_num = wsor.substitute_group_num);
end delete_orphaned_alternates;
select operation_seq_num
from wip_operations
where wip_entity_id = p_wip_entity_id
and nvl(repetitive_schedule_id,-1) = nvl(p_schedule_id, -1);
select * from (select resource_seq_num,
schedule_seq_num,
substitute_group_num,
scheduled_flag,
parent_resource_seq /* added for bug 4747951 */
from wip_operation_resources
where wip_entity_id = p_wip_entity_id
and nvl(repetitive_schedule_id,-1) = nvl(p_schedule_id,-1)
and operation_seq_num = p_op_seq_num
union
select resource_seq_num,
schedule_seq_num,
substitute_group_num,
scheduled_flag,
null parent_resource_seq /* added for bug 4747951 */
from wip_sub_operation_resources
where wip_entity_id = p_wip_entity_id
and nvl(repetitive_schedule_id,-1) = nvl(p_schedule_id,-1)
and operation_seq_num = p_op_seq_num
)
order by nvl(schedule_seq_num, resource_seq_num);
Procedure Update_Resource_Instances(p_wip_entity_id NUMBER,
p_org_id NUMBER) is
cursor operation_rsc (p_wip_entity_id NUMBER, p_org_id NUMBER) is
select operation_seq_num,
resource_seq_num,
start_date,
completion_date
from wip_operation_resources
where wip_entity_id = p_wip_entity_id
and organization_id = p_org_id;
UPDATE wip_op_resource_instances
SET start_date = cur_rsc.start_date,
completion_date = cur_rsc.completion_date
WHERE wip_entity_id = p_wip_entity_id
and organization_id = p_org_id
and operation_seq_num = cur_rsc.operation_seq_num
and resource_seq_num = cur_rsc.resource_seq_num;
End Update_Resource_Instances;