The following lines contain the word 'select', 'insert', 'update' or 'delete':
select 'Y'
from dual
where exists
(select null
from per_all_people_f papf
where papf.person_id = p_person_id
and papf.registered_disabled_flag is not null)
or
exists (select null
from per_disabilities_f pdf,
per_all_people_f papf
where pdf.person_id =papf.person_id
and pdf.category not in ('Y','N','ND')
and papf.person_id = p_person_id);
select nvl(decode(papf.registered_disabled_flag,'Y','Yes','F','Yes - Fully Disabled','P','Yes - Partially Disabled','N','No',null),' ') old_category,
nvl(decode(papf.registered_disabled_flag, 'Y','Yes','F','Yes','P','Yes','N','No',null),' ') new_category,
nvl(decode(papf.registered_disabled_flag, 'Y','Y','F','Y','P','Y','N','N',null),' ') category,
nvl(papf.national_identifier,' ') ni_no,
papf.effective_start_date effective_start_date,
papf.effective_end_date effective_end_date,
papf.object_version_number,
nvl(papf.employee_number,' ') employee_number ,
papf.person_id person_id,
nvl(papf.full_name,' ') full_name
from per_all_people_f papf
where papf.person_id = p_person_id
and papf.registered_disabled_flag is not null
order by papf.person_id,effective_start_date;
select pdf.disability_id,
pdf.object_version_number
from per_disabilities_f pdf
where pdf.person_id = p_person_id
order by pdf.effective_start_date desc;
select pdf.disability_id,
pdf.object_version_number
from per_disabilities_f pdf
where pdf.person_id = p_person_id
order by pdf.effective_start_date desc;
select distinct papf.person_id person_id,
nvl(papf.full_name,' ') full_name,
pdf.disability_id disability_id,
nvl(papf.national_identifier,' ') ni_no,
nvl(pdf.category,' ') category,
nvl(pdf.quota_fte,'') quota_fte,
nvl(pdf.degree,'') degree,
pdf.effective_start_date effective_start_date,
pdf.effective_end_date effective_end_date,
pdf.object_version_number object_version_number
from per_disabilities_f pdf,
per_all_people_f papf
where pdf.person_id =papf.person_id
and (pdf.category not in ('Y','N','ND'))
and papf.person_id = p_person_id
order by papf.person_id;
insert into per_disabilities_f
(disability_id
,effective_start_date
,effective_end_date
,person_id
,category
,status
,degree
,quota_fte
,object_version_number
,created_by
,creation_date
,last_update_date
,last_updated_by
,last_update_login
)
Values
(per_disabilities_s.nextval
,v_csr_details.effective_start_date
,v_csr_details.effective_end_date
,p_person_id
,v_csr_details.category
,'A'
,null
,1.0
,1
,-1
,sysdate
,sysdate
,-1
,-1
);
-- Creating date track updates against Disability records
hr_utility.set_location('Entering ' || l_proc,40);
insert into per_disabilities_f
(disability_id
,effective_start_date
,effective_end_date
,person_id
,category
,status
,degree
,quota_fte
,object_version_number
,created_by
,creation_date
,last_update_date
,last_updated_by
,last_update_login
)
select
v_disability_id_new
,v_csr_details.effective_start_date
,v_csr_details.effective_end_date
,p_person_id
,v_csr_details.category
,'A'
,null
,1.0
,v_object_version_number_new
,-1
,sysdate
,sysdate
,-1
,-1
from dual
where not exists
(select null from per_disabilities_f
where effective_start_date = v_csr_details.effective_start_date
and effective_end_date = v_csr_details.effective_end_date
and person_id = p_person_id)
;
end if; -- end of insert
update per_disabilities_f
set effective_end_date = v_csr_details.effective_end_date
where disability_id = v_disability_id_new
and category = v_csr_details.category;
update per_all_people_f
set registered_disabled_flag = null
where person_id = p_person_id
and effective_start_date = v_csr_details.effective_start_date;
update per_disabilities_f
set category='Y'
where effective_start_date = v_dis_det.effective_start_date
and disability_id = v_dis_det.disability_id ;