The following lines contain the word 'select', 'insert', 'update' or 'delete':
,select_stmt out nocopy varchar2) is
type EmpCurTyp is ref cursor;
l_select_stmt_per VARCHAR2(20000);
l_select_stmt_per2 VARCHAR2(20000);
l_select_stmt_asg VARCHAR2(20000);
select x.name
from per_business_groups x
where x.business_group_id = p_business_group_id;
select *
from per_all_people_f
where person_id=p_person_id
and p_effective_date between effective_start_date and effective_end_date;
select description
from fnd_languages_vl
where language_code=p_lang_code;
select name
from ben_benfts_grp
where benfts_grp_id=p_benfts_grp_id;
select *
from per_all_assignments_f
where assignment_id=p_assignment_id
and p_effective_date between effective_start_date and effective_end_date;
select count(*)
from per_all_assignments_f per_asg
where per_asg.person_id=p_person_id
and p_effective_date between per_asg.effective_start_date and per_asg.effective_end_date
and per_asg.assignment_type <> 'B' ; -- Added for fix of #3286659
select full_name
from per_all_people_f
where person_id=p_person_id
and p_effective_date between effective_start_date and effective_end_date;
select assignment_number
from per_all_assignments_f
where assignment_id = p_supervisor_assignment_id
and p_effective_date between effective_start_date and effective_end_date;
select date_start
from per_periods_of_service
where person_id=p_person_id
and p_effective_date between date_start and nvl(final_process_date,p_effective_date);
select projected_hire_date
from per_applications
where person_id=p_person_id
and p_effective_date between date_received and nvl(date_end,p_effective_date);
select name
from per_grades_vl
where grade_id=p_grade_id;
select name
from ben_pgm_f
where pgm_id = p_grade_ladder_pgm_id
and p_effective_date between effective_start_date and effective_end_date;
select name
from hr_all_positions_f_tl
where position_id=p_position_id
and language = userenv('LANG');
select name
from per_jobs_vl
where job_id=p_job_id;
SELECT
nvl(atl.user_status ,stl.user_status),
nvl(a.per_system_status ,s.per_system_status)
FROM
per_ass_status_type_amends_tl atl,
per_ass_status_type_amends a,
per_assignment_status_types_tl stl,
per_assignment_status_types s
WHERE
s.assignment_status_type_id=p_assignment_status_type_id and
a.assignment_status_type_id (+)=s.assignment_status_type_id and
a.business_group_id (+) = s.business_group_id and
nvl(a.active_flag, s.active_flag)='Y' and
a.ass_status_type_amend_id=atl.ass_status_type_amend_id (+) and
decode(atl.language,null,'1',atl.language)=decode(atl.language,null,'1',userenv('LANG')) and
s.assignment_status_type_id=stl.assignment_status_type_id and
stl.language=userenv('LANG');
select payroll_name
from pay_all_payrolls_f
where payroll_id=p_payroll_id
and p_effective_date between effective_start_date and effective_end_date;
select location_code
from hr_locations
where location_id=p_location_id;
select name
from per_recruitment_activities
where recruitment_activity_id=p_recruitment_activity_id;
select name
from hr_organization_units
where organization_id=p_organization_id;
select * from pay_people_groups
where people_group_id=p_people_group_id;
select * from hr_soft_coding_keyflex
where soft_coding_keyflex_id=p_soft_coding_keyflex_id;
select vac.name
, rec.name
from per_vacancies vac
, per_requisitions rec
where vac.vacancy_id=p_vacancy_id
and vac.requisition_id=rec.requisition_id;
select ppb.name
, ppb.pay_basis
from per_pay_bases ppb
where ppb.pay_basis_id=p_pay_basis;
select psp.spinal_point spinal_point
, count(*) step
from per_spinal_points psp
, per_spinal_points psp2
, per_spinal_point_steps_f psps
, per_spinal_point_steps_f psps2
where psp.spinal_point_id=psps.spinal_point_id
and psps.grade_spine_id=psps2.grade_spine_id
and psp2.spinal_point_id=psps2.spinal_point_id
and psps.step_id=p_special_ceiling_step_id
and psp.sequence >=psp2.sequence
and p_effective_date between psps.effective_start_date
and psps.effective_end_date
and p_effective_date between psps2.effective_start_date
and psps2.effective_end_date
group by psp.spinal_point
, psps.step_id
, psps.sequence
, psps.effective_start_date
, psps.effective_end_date
order by 2;
select reference
from per_contracts_f
where contract_id=p_contract_id
and p_effective_date between effective_start_date and effective_end_date;
select name
from per_collective_agreements
where collective_agreement_id=p_collective_agreement_id;
select id_flex_structure_name
from fnd_id_flex_structures_vl
where id_flex_code='CAGR'
and application_id=800
and id_flex_num=p_id_flex_num;
select vendor_name
from po_vendors pov
where pov.vendor_id = p_vendor_id;
select vendor_site_code
from po_vendor_sites
where vendor_site_id=p_vendor_site_id;
select segment1
from po_headers_all
where po_header_id = p_po_header_id;
select line_num
from po_lines_all
where po_line_id = p_po_line_id;
l_where:=l_where||'(select '||p_child_column||' from '||
p_child_table||' where upper('||p_child_meaning||')';
l_where:=l_where||'(select '||p_child_column||' from '||
p_child_table||' where '||p_child_meaning;
l_where:='and per_asg.grade_id in (select grd_a.grade_id from per_grades_vl grd_a where grd_a.sequence';
l_where:=l_where||'(select grd_a2.sequence from per_grades_vl grd_a2 where grd_a2.name like ('''
||p_value||''') ) )';
elsif p_field_name='RESUME_LAST_UPDATED' then
l_a_where_clause:=build_date_where('per.resume_last_updated',p_condition,p_value);
|| ' (SELECT ptu.person_id'
|| ' FROM per_person_type_usages_f ptu'
|| ' WHERE ptu.person_type_id = '||person_type_id
|| ' AND ' ||l_effective_date_clause
|| ' BETWEEN ptu.effective_start_date'
|| ' AND ptu.effective_end_date)';
|| ' (SELECT ptu.person_id'
|| ' FROM per_person_type_usages_f ptu'
|| ' ,per_person_types_tl ppttl'
|| ' WHERE ptu.person_type_id = ppttl.person_type_id'
|| ' AND UPPER(ppttl.user_person_type)'
|| ' LIKE '''||upper(replace(person_type,g_quote,g_quote||g_quote))||''''
|| ' AND ppttl.language = userenv(''LANG'')'
|| ' AND '||l_effective_date_clause
|| ' BETWEEN ptu.effective_start_date'
|| ' AND ptu.effective_end_date)';*/
|| ' (SELECT /*+ push_subq no_unnest */ 1'
|| ' FROM per_person_type_usages_f ptu'
|| ' ,per_person_types_tl ppttl'
|| ' WHERE ptu.person_type_id = ppttl.person_type_id'
|| ' AND ptu.person_id=per.person_id'
|| ' AND UPPER(ppttl.user_person_type)'
|| ' LIKE '''||upper(replace(person_type,g_quote,g_quote||g_quote))||''''
|| ' AND ppttl.language = userenv(''LANG'')'
|| ' AND '||l_effective_date_clause
|| ' BETWEEN ptu.effective_start_date'
|| ' AND ptu.effective_end_date)';
|| ' (SELECT ptu.person_id'
|| ' FROM per_person_type_usages_f ptu'
|| ' ,per_person_types ppt'
|| ' WHERE ptu.person_type_id = ppt.person_type_id'
|| ' AND ppt.system_person_type ='''||system_person_type||''''
|| ' AND '||l_effective_date_clause
|| ' BETWEEN ptu.effective_start_date'
|| ' AND ptu.effective_end_date)';
||' (select 1'
||' from hr_leg_establishments_v hle'
||' where hle.organization_id = per_asg.establishment_id and upper(hle.name) like('''||upper(establishment)||'''))';
l_select_stmt_per:=
'select per.person_id,nvl(per.order_name,per.full_name),count(*) '||l_from_clause||l_where_clause;
l_select_stmt_per:=l_select_stmt_per
||' AND (( EXISTS'
|| ' (SELECT 1'
|| ' FROM pay_restriction_values prv'
|| ' WHERE prv.customized_restriction_id = '
|| p_customized_restriction_id
|| ' AND prv.value IN'
|| ' (SELECT ptu.person_type_id'
|| ' FROM per_person_type_usages ptu'
|| ' WHERE ptu.person_id = per.person_id'
|| ' AND '||l_effective_date_clause
|| ' BETWEEN ptu.effective_start_date'
|| ' AND ptu.effective_end_date)'
|| ' AND NVL(prv.include_exclude_flag, ''I'') = ''I'' '
|| ' AND prv.restriction_code = ''PERSON_TYPE'')'
|| ' OR NOT EXISTS'
|| ' (SELECT 1'
|| ' FROM pay_restriction_values prv'
|| ' WHERE prv.customized_restriction_id ='
|| p_customized_restriction_id
|| ' AND NVL(prv.include_exclude_flag, ''I'') = ''I'' '
|| ' AND prv.restriction_code = ''PERSON_TYPE'') )'
||' AND NOT EXISTS '
|| ' (SELECT 1'
|| ' FROM pay_restriction_values prv2'
|| ' WHERE prv2.customized_restriction_id = '
|| p_customized_restriction_id
|| ' AND prv2.value IN'
|| ' (SELECT ptu2.person_type_id'
|| ' FROM per_person_type_usages ptu2'
|| ' WHERE ptu2.person_id = per.person_id'
|| ' AND '||l_effective_date_clause
|| ' BETWEEN ptu2.effective_start_date'
|| ' AND ptu2.effective_end_date)'
|| ' AND NVL(prv2.include_exclude_flag, ''I'') = ''E'' '
|| ' AND prv2.restriction_code = ''PERSON_TYPE''))';
l_select_stmt_per:=l_select_stmt_per||
' and ( (per.current_emp_or_apl_flag is null and per.current_npw_flag is null)';
l_select_stmt_per:=l_select_stmt_per||
' OR per.current_employee_flag =''Y'' ';
l_select_stmt_per:=l_select_stmt_per||
' OR per.current_applicant_flag =''Y'' ';
l_select_stmt_per:=l_select_stmt_per||
' OR per.current_npw_flag = ''Y'' ';
l_select_stmt_per:=l_select_stmt_per||')';
l_select_stmt_per:=l_select_stmt_per||' group by per.person_id,nvl(per.order_name,per.full_name) order by nvl(per.order_name,per.full_name)';
hr_utility.set_location('r'||l_select_stmt_per,2001);
select_stmt:=l_from_clause||l_where_clause;
l_select_stmt_asg:='select per_asg.assignment_id '||l_from_clause;
l_select_stmt_asg:=l_select_stmt_asg||',per_all_assignments_f per_asg';
l_select_stmt_asg:=l_select_stmt_asg||l_where_clause;
l_select_stmt_asg:=l_select_stmt_asg||' and per.person_id=per_asg.person_id and '
||l_effective_date||
' between per_asg.effective_start_date and per_asg.effective_end_date ';
l_select_stmt_asg:=l_select_stmt_asg||'and per_asg.assignment_type <> ''B''';-- Added for fix of #3286659
l_select_stmt_asg:=l_select_stmt_asg||' and per.person_id=:1';
l_select_stmt_per2:=l_select_stmt_per;
hr_utility.set_location('r'||l_select_stmt_per,2000);
while length(l_select_stmt_per2)>0 loop
hr_utility.set_location(substr(l_select_stmt_per2,1,70),1);
l_select_stmt_per2:=substr(l_select_stmt_per2,71);
hr_utility.set_location('hidd'||l_select_stmt_per,1000);
open emp_cv for l_select_stmt_per;
out_rec.resume_last_updated :=per_rec.resume_last_updated;
execute immediate l_select_stmt_asg into l_assignment_id using per_rec.person_id;
procedure insert_varchar2(p_query_id number
,p_field varchar2
,p_value varchar2
) is
begin
insert into per_query_criteria
(query_id
,field
,field_type
,varchar2_value
,number_value
,date_value
,object_version_number)
values
(p_query_id
,p_field
,'V'
,replace(p_value,g_quote,g_quote||g_quote)
,null
,null
,1);
end insert_varchar2;
procedure insert_number (p_query_id number
,p_field varchar2
,p_value number
) is
begin
insert into per_query_criteria
(query_id
,field
,field_type
,varchar2_value
,number_value
,date_value
,object_version_number)
values
(p_query_id
,p_field
,'N'
,null
,p_value
,null
,1);
end insert_number;
procedure insert_date (p_query_id number
,p_field varchar2
,p_value date
) is
begin
insert into per_query_criteria
(query_id
,field
,field_type
,varchar2_value
,number_value
,date_value
,object_version_number)
values
(p_query_id
,p_field
,'D'
,null
,null
,p_value
,1);
end insert_date;
insert_number(l_query_id,'BUSINESS_GROUP_ID',business_group_id);
insert_varchar2(l_query_id,'BUSINESS_GROUP_NAME',business_group_name);
insert_number(l_query_id,'PERSON_ID',person_id);
insert_varchar2(l_query_id,'PERSON_TYPE',person_type);
insert_varchar2(l_query_id,'SYSTEM_PERSON_TYPE',system_person_type);
insert_number(l_query_id,'PERSON_TYPE_ID',person_type_id);
insert_varchar2(l_query_id,'LAST_NAME',last_name);
insert_date(l_query_id,'START_DATE',start_date);
insert_date(l_query_id,'HIRE_DATE',hire_date);
insert_varchar2(l_query_id,'APPLICANT_NUMBER',applicant_number);
insert_date(l_query_id,'DATE_OF_BIRTH',date_of_birth);
insert_varchar2(l_query_id,'EMAIL_ADDRESS',email_address);
insert_varchar2(l_query_id,'EMPLOYEE_NUMBER',employee_number);
insert_varchar2(l_query_id,'NPW_NUMBER',npw_number);
insert_varchar2(l_query_id,'PROJECT_TITLE',project_title);
insert_number(l_query_id,'VENDOR_ID',vendor_id);
insert_varchar2(l_query_id,'VENDOR_NAME',vendor_name);
insert_varchar2(l_query_id,'VENDOR_EMPLOYEE_NUMBER',vendor_employee_number);
insert_varchar2(l_query_id,'VENDOR_ASSIGNMENT_NUMBER',vendor_assignment_number);
insert_number(l_query_id,'VENDOR_SITE_ID',vendor_site_id);
insert_varchar2(l_query_id,'VENDOR_SITE_CODE',vendor_site_code);
insert_number(l_query_id,'PO_HEADER_ID',po_header_id);
insert_varchar2(l_query_id,'PO_HEADER_NUM',po_header_num);
insert_number(l_query_id,'PO_LINE_ID',po_line_id);
insert_varchar2(l_query_id,'PO_LINE_NUM',po_line_num);
insert_varchar2(l_query_id,'FIRST_NAME',first_name);
insert_varchar2(l_query_id,'FULL_NAME',full_name);
insert_varchar2(l_query_id,'TITLE',title);
insert_varchar2(l_query_id,'MIDDLE_NAMES',middle_names);
insert_varchar2(l_query_id,'NATIONALITY_MEANING',nationality_meaning);
insert_varchar2(l_query_id,'NATIONALITY',nationality);
insert_varchar2(l_query_id,'NATIONAL_IDENTIFIER',national_identifier);
insert_varchar2(l_query_id,'REGISTERED_DISABLED_FLAG',registered_disabled_flag);
insert_varchar2(l_query_id,'REGISTERED_DISABLED',registered_disabled);
insert_varchar2(l_query_id,'SEX_MEANING',sex_meaning);
insert_varchar2(l_query_id,'SEX',sex);
insert_varchar2(l_query_id,'BENEFIT_GROUP',benefit_group);
insert_number(l_query_id,'BENEFIT_GROUP_ID',benefit_group_id);
insert_varchar2(l_query_id,'GRADE',grade);
insert_number(l_query_id,'GRADE_ID',grade_id);
insert_varchar2(l_query_id,'GRADE_LADDER',grade_ladder);
insert_number(l_query_id,'GRADE_LADDER_PGM_ID',grade_ladder_pgm_id);
insert_varchar2(l_query_id,'POSITION',position);
insert_number(l_query_id,'POSITION_ID',position_id);
insert_varchar2(l_query_id,'JOB',job);
insert_number(l_query_id,'JOB_ID',job_id);
insert_varchar2(l_query_id,'ASSIGNMENT_STATUS_TYPE',assignment_status_type);
insert_number(l_query_id,'ASSIGNMENT_STATUS_TYPE_ID',assignment_status_type_id);
insert_varchar2(l_query_id,'PAYROLL',payroll);
insert_number(l_query_id,'PAYROLL_ID',payroll_id);
insert_varchar2(l_query_id,'LOCATION',location);
insert_number(l_query_id,'LOCATION_ID',location_id);
insert_varchar2(l_query_id,'SUPERVISOR',supervisor);
insert_number(l_query_id,'SUPERVISOR_ID',supervisor_id);
insert_varchar2(l_query_id,'SUPERVISOR_ASSIGNMENT_NUMBER',supervisor_assignment_number);
insert_number(l_query_id,'SUPERVISOR_ASSIGNMENT_ID',supervisor_assignment_id);
insert_varchar2(l_query_id,'RECRUITMENT_ACTIVITY',recruitment_activity);
insert_number(l_query_id,'RECRUITMENT_ACTIVITY_ID',recruitment_activity_id);
insert_varchar2(l_query_id,'ORGANIZATION',organization);
insert_number(l_query_id,'ORGANIZATION_ID',organization_id);
insert_varchar2(l_query_id,'PEOPLE_GROUP',people_group);
insert_number(l_query_id,'PEOPLE_GROUP_ID',people_group_id);
insert_varchar2(l_query_id,'VACANCY',vacancy);
insert_number(l_query_id,'VACANCY_ID',vacancy_id);
insert_varchar2(l_query_id,'REQUISITION',requisition);
insert_number(l_query_id,'REQUISITION_ID',requisition_id);
insert_varchar2(l_query_id,'SALARY_BASIS',salary_basis);
insert_number(l_query_id,'PAY_BASIS_ID',pay_basis_id);
insert_varchar2(l_query_id,'BARGAINING_UNIT_CODE_MEANING',bargaining_unit_code_meaning);
insert_varchar2(l_query_id,'BARGAINING_UNIT_CODE',bargaining_unit_code);
insert_varchar2(l_query_id,'EMPLOYMENT_CATEGORY_MEANING',employment_category_meaning);
insert_varchar2(l_query_id,'EMPLOYMENT_CATEGORY',employment_category);
insert_varchar2(l_query_id,'ESTABLISHMENT',establishment);
insert_number(l_query_id,'ESTABLISHMENT_ID',establishment_id);
insert_date(l_query_id,'PROJECTED_HIRE_DATE',projected_hire_date);
insert_varchar2(l_query_id,'SECURE',secure);
insert_varchar2(l_query_id,'FIELD1_NAME',field1_name);
insert_varchar2(l_query_id,'FIELD1_CONDITION_CODE',field1_condition_code);
insert_varchar2(l_query_id,'FIELD1_VALUE',field1_value);
insert_varchar2(l_query_id,'FIELD2_NAME',field2_name);
insert_varchar2(l_query_id,'FIELD2_CONDITION_CODE',field2_condition_code);
insert_varchar2(l_query_id,'FIELD2_VALUE',field2_value);
insert_varchar2(l_query_id,'FIELD3_NAME',field3_name);
insert_varchar2(l_query_id,'FIELD3_CONDITION_CODE',field3_condition_code);
insert_varchar2(l_query_id,'FIELD3_VALUE',field3_value);
insert_varchar2(l_query_id,'FIELD4_NAME',field4_name);
insert_varchar2(l_query_id,'FIELD4_CONDITION_CODE',field4_condition_code);
insert_varchar2(l_query_id,'FIELD4_VALUE',field4_value);
insert_varchar2(l_query_id,'FIELD5_NAME',field5_name);
insert_varchar2(l_query_id,'FIELD5_CONDITION_CODE',field5_condition_code);
insert_varchar2(l_query_id,'FIELD5_VALUE',field5_value);
select varchar2_value
from per_query_criteria
where query_id=p_query_id
and field=p_field;
select number_value
from per_query_criteria
where query_id=p_query_id
and field=p_field;
select date_value
from per_query_criteria
where query_id=p_query_id
and field=p_field;
l_select_stmt_per VARCHAR2(20000);
,select_stmt => l_select_stmt_per);