The following lines contain the word 'select', 'insert', 'update' or 'delete':
select organization_id , status_type
into l_organization_id , l_status_type
from wip_discrete_jobs
where wip_entity_id = p_wip_entity_id;
select wip_entity_id into temp
from wip_eam_work_requests
where work_request_id = p_req_id
and organization_id = l_organization_id;
Update wip_eam_work_requests
set wip_entity_id = p_wip_entity_id,
work_request_status_id = decode(l_status_type,4,6,5,6,4) ,
last_update_date = sysdate,
last_updated_by = FND_GLOBAL.user_id
where work_request_id = p_req_id
and organization_id = l_organization_id;
select count(1)
into l_servicereq_count
from eam_wo_service_association
where maintenance_organization_id = l_organization_id
and wip_entity_id = p_wip_entity_id
and (enable_flag IS NULL OR enable_flag = 'Y'); -- Fix for 3773450
insert into eam_wo_service_association
(wo_service_entity_assoc_id,
maintenance_organization_id,
wip_entity_id,
service_request_id,
creation_date,
created_by,
last_update_login,
program_id,
attribute1,
attribute2,
attribute3,
attribute4,
attribute5,
attribute6,
attribute7,
attribute8,
attribute9,
attribute10,
attribute11,
attribute12,
attribute13,
attribute14,
attribute15,
attribute_category,
last_updated_by,
last_update_date,
enable_flag) -- Fix for 3773450
values
(eam_wo_service_association_s.nextval,
l_organization_id,
p_wip_entity_id,
p_req_id,
sysdate,
FND_GLOBAL.USER_ID,
FND_GLOBAL.LOGIN_ID,
null,--fnd_global.conc_program_id,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
fnd_global.user_id,
sysdate,
'Y'); -- Fix for 3773450
procedure delete_assignment(
p_api_version in NUMBER,
p_init_msg_list in VARCHAR2 := FND_API.G_FALSE,
p_commit in VARCHAR2 := FND_API.G_FALSE,
p_validation_level in NUMBER := FND_API.G_VALID_LEVEL_FULL,
x_return_status out NOCOPY VARCHAR2,
x_msg_count out NOCOPY NUMBER,
x_msg_data out NOCOPY VARCHAR2,
p_wip_entity_id in NUMBER,
p_req_type in NUMBER,
p_req_num in VARCHAR2,
p_req_id in NUMBER
) is
l_api_name CONSTANT VARCHAR2(30) := 'delete_assignment';
SAVEPOINT eam_delete_assignment;
select organization_id
into l_organization_id
from wip_discrete_jobs
where wip_entity_id = p_wip_entity_id;
update wip_eam_work_requests
set wip_entity_id = null,
work_request_status_id = 3,
last_update_date = sysdate,
last_updated_by = FND_GLOBAL.user_id
where work_request_id = p_req_id
and organization_id = l_organization_id;
update eam_wo_service_association -- Fix for 3773450
set enable_flag = 'N',
last_update_date = sysdate,
last_updated_by = FND_GLOBAL.user_id,
last_update_login = FND_GLOBAL.login_id
where service_request_id = p_req_id
and wip_entity_id = p_wip_entity_id
and maintenance_organization_id = l_organization_id
and (enable_flag IS NULL or enable_flag = 'Y');
ROLLBACK TO eam_delete_assignment;
ROLLBACK TO eam_delete_assignment;
ROLLBACK TO eam_delete_assignment;
end delete_assignment;