The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT formula_id
FROM ff_formulas_x
WHERE formula_name = 'BUDGET_' || p_formula_name
AND business_group_id = p_business_group_id;
SELECT formula_id
FROM ff_formulas_x
WHERE formula_name = 'TEMPLATE_' || p_formula_name
AND business_group_id IS NULL;
SELECT
b.unit
,b.business_group_id
FROM per_budgets b
WHERE b.budget_id = p_budget_id;
SELECT tp.end_date
FROM per_time_periods tp
WHERE tp.time_period_id = p_time_period_id;
/* passed in a different cursor is used. The most selective parameter to use */
/* is p_position_id, so this is checked first, followed by grade, job and */
/* organization. If all parameters are null, then business group id is used. */
/* Note that the option of using this index is disabled in the former four */
/* cursors. This is to prevent an inefficient query plan being used. */
/*----------------------------------------------------------------------------*/
/* To be accessed if p_position_id is not null */
CURSOR pos_assignment_csr(
p_business_group_id NUMBER
,p_grade_id NUMBER
,p_job_id NUMBER
,p_organization_id NUMBER
,p_position_id NUMBER
,p_period_end_date DATE) is
SELECT asg.assignment_id
FROM per_assignments_f asg
,per_assignment_status_types ast
WHERE p_position_id = asg.position_id
AND (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
AND (p_job_id IS NULL OR asg.job_id = p_job_id)
AND (p_grade_id IS NULL OR asg.grade_id = p_grade_id)
AND asg.business_group_id + 0 = p_business_group_id
AND asg.assignment_type = 'E'
AND p_period_end_date BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.assignment_status_type_id = ast.assignment_status_type_id
AND ast.per_system_status = 'ACTIVE_ASSIGN';
SELECT asg.assignment_id
FROM per_assignments_f asg
,per_assignment_status_types ast
WHERE (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
AND (p_job_id IS NULL OR asg.job_id = p_job_id)
AND p_grade_id = asg.grade_id
AND asg.business_group_id + 0 = p_business_group_id
AND asg.assignment_type = 'E'
AND p_period_end_date BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.assignment_status_type_id = ast.assignment_status_type_id
AND ast.per_system_status = 'ACTIVE_ASSIGN';
SELECT asg.assignment_id
FROM per_assignments_f asg
,per_assignment_status_types ast
WHERE (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
AND p_job_id = asg.job_id
AND asg.business_group_id + 0 = p_business_group_id
AND asg.assignment_type = 'E'
AND p_period_end_date BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.assignment_status_type_id = ast.assignment_status_type_id
AND ast.per_system_status = 'ACTIVE_ASSIGN';
SELECT asg.assignment_id
FROM per_assignments_f asg
,per_assignment_status_types ast
WHERE p_organization_id = asg.organization_id
AND asg.business_group_id + 0 = p_business_group_id
AND asg.assignment_type = 'E'
AND p_period_end_date BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.assignment_status_type_id = ast.assignment_status_type_id
AND ast.per_system_status = 'ACTIVE_ASSIGN';
SELECT asg.assignment_id
FROM per_assignments_f asg
,per_assignment_status_types ast
WHERE asg.business_group_id = p_business_group_id
AND asg.assignment_type = 'E'
AND p_period_end_date BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.assignment_status_type_id = ast.assignment_status_type_id
AND ast.per_system_status = 'ACTIVE_ASSIGN';
/* passed in a different cursor is used. The most selective parameter to use */
/* is p_position_id, so this is checked first, followed by grade, job and */
/* organization. If all parameters are null, then business group id is used. */
/* Note that the option of using this index is disabled in the former four */
/* cursors. This is to prevent an inefficient query plan being used. */
/*----------------------------------------------------------------------------*/
IF (p_position_id IS NOT NULL) THEN
FOR assignment_rec in pos_assignment_csr(
l_business_group_id
,p_grade_id
,p_job_id
,p_organization_id
,p_position_id
,l_period_end_date) LOOP
l_assignment_id := assignment_rec.assignment_id;
select pst1.system_type_cd unit1_name
, pst2.system_type_cd unit2_name
, pst3.system_type_cd unit3_name
, bgt.business_group_id business_group_id
from pqh_budgets bgt
, per_shared_types_vl pst1
, per_shared_types_vl pst2
, per_shared_types_vl pst3
where bgt.budget_id = p_budget_id
AND bgt.budget_unit1_id = pst1.shared_type_id (+)
AND bgt.budget_unit2_id = pst2.shared_type_id (+)
AND bgt.budget_unit3_id = pst3.shared_type_id (+);
select tp.end_date
from per_time_periods tp, pqh_budget_periods bpr
where bpr.budget_period_id = p_time_period_id
and tp.time_period_id = bpr.end_time_period_id;
/* passed in a different cursor is used. The most selective parameter to use */
/* is p_position_id, so this is checked first, followed by grade, job and */
/* organization. If all parameters are null, then business group id is used. */
/* Note that the option of using this index is disabled in the former four */
/* cursors. This is to prevent an inefficient query plan being used. */
/*----------------------------------------------------------------------------*/
/* To be used if p_position_id is not null */
cursor pos_assignment_csr(
p_business_group_id NUMBER
,p_grade_id NUMBER
,p_job_id NUMBER
,p_organization_id NUMBER
,p_position_id NUMBER
,p_period_end_date DATE
) is
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
and p_position_id = asg.position_id
and (p_job_id IS NULL OR asg.job_id = p_job_id)
and (p_grade_id IS NULL OR asg.grade_id = p_grade_id)
and asg.business_group_id + 0 = p_business_group_id
and asg.assignment_type = 'E'
and p_period_end_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
and (p_job_id IS NULL OR asg.job_id = p_job_id)
and p_grade_id = asg.grade_id
and asg.business_group_id + 0 = p_business_group_id
and asg.assignment_type = 'E'
and p_period_end_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
and p_job_id = asg.job_id
and asg.business_group_id + 0 = p_business_group_id
and asg.assignment_type = 'E'
and p_period_end_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where p_organization_id = asg.organization_id
and asg.business_group_id + 0 = p_business_group_id
and asg.assignment_type = 'E'
and p_period_end_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where asg.business_group_id = p_business_group_id
and asg.assignment_type = 'E'
and p_period_end_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
/* passed in a different cursor is used. The most selective parameter to use */
/* is p_position_id, so this is checked first, followed by grade, job and */
/* organization. If all parameters are null, then business group id is used. */
/* Note that the option of using this index is disabled in the former four */
/* cursors. This is to prevent an inefficient query plan being used. */
/*----------------------------------------------------------------------------*/
IF (p_position_id IS NOT NULL) THEN
FOR assignment_rec IN pos_assignment_csr(
l_business_group_id
,p_grade_id
,p_job_id
,p_organization_id
,p_position_id
,l_period_end_date
) LOOP
l_assignment_id := assignment_rec.assignment_id;
SELECT count(*) INTO v_direct_reports
FROM per_all_assignments_f asg, per_all_people_f peo
WHERE asg.supervisor_id = v_person_id
AND v_effective_end_date BETWEEN asg.effective_start_date
AND asg.effective_end_date
AND asg.person_id = peo.person_id
AND v_effective_end_date
BETWEEN peo.effective_start_date AND peo.effective_end_date
AND peo.current_employee_flag = 'Y' ;
SELECT lookup_code
FROM hr_standard_lookups
WHERE lookup_type = 'BUDGET_MEASUREMENT_TYPE'
AND meaning = p_bmt_meaning;
SELECT pst1.system_type_cd unit1_name
, pst2.system_type_cd unit2_name
, pst3.system_type_cd unit3_name
, bgt.business_group_id business_group_id
FROM pqh_budgets bgt
, per_shared_types_vl pst1
, per_shared_types_vl pst2
, per_shared_types_vl pst3
WHERE bgt.budget_id = p_budget_id
AND bgt.budget_unit1_id = pst1.shared_type_id (+)
AND bgt.budget_unit2_id = pst2.shared_type_id (+)
AND bgt.budget_unit3_id = pst3.shared_type_id (+);
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
and p_position_id = asg.position_id
and (p_job_id IS NULL OR asg.job_id = p_job_id)
and (p_grade_id IS NULL OR asg.grade_id = p_grade_id)
and asg.business_group_id = p_business_group_id
and asg.assignment_type = 'E'
and p_effective_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
and (p_job_id IS NULL OR asg.job_id = p_job_id)
and p_grade_id = asg.grade_id
and asg.business_group_id = p_business_group_id
and asg.assignment_type = 'E'
and p_effective_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where (p_organization_id IS NULL OR asg.organization_id = p_organization_id)
and p_job_id = asg.job_id
and asg.business_group_id = p_business_group_id
and asg.assignment_type = 'E'
and p_effective_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where p_organization_id = asg.organization_id
and asg.business_group_id = p_business_group_id
and asg.assignment_type = 'E'
and p_effective_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
select asg.assignment_id
from per_assignments_f asg
,per_assignment_status_types ast
where asg.business_group_id = p_business_group_id
and asg.assignment_type = 'E'
and p_effective_date between asg.effective_start_date and
asg.effective_end_date
and asg.assignment_status_type_id = ast.assignment_status_type_id
and ast.per_system_status = 'ACTIVE_ASSIGN';
SELECT sum(months_between(least(nvl(actual_termination_date + 1,
p_effective_date + 1), p_effective_date + 1), date_start)) total_months
FROM per_periods_of_service
WHERE person_id = p_person_id
AND date_start <= p_effective_date
AND period_of_service_id <= p_period_of_service_id;
SELECT sum(months_between
(least(nvl(actual_termination_date + 1, p_effective_date + 1),
p_effective_date + 1), date_start)) / 12 total_years
FROM per_periods_of_service
WHERE person_id = p_person_id
AND date_start <= p_effective_date
AND period_of_service_id <= p_period_of_service_id;