The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT lkp.meaning
INTO l_labor_unit
FROM pji_lookups lkp,
pji_system_settings setup
WHERE lkp.lookup_type = G_Labor_Units_LT
AND lkp.lookup_code = setup.report_labor_units;
select distinct proj.name
from pa_projects_all proj
,pa_forecast_items fi
,pa_forecast_item_details fid
where fi.item_date = trunc(p_date)
and proj.project_id = fi.project_id
and fi.person_id = p_person_id
and fi.expenditure_organization_id = p_exp_org_id
and fi.forecast_item_id = fid.forecast_item_id
and fid.pji_summarized_flag is null
and rownum = 1;
SELECT max(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt1_s = 0;
SELECT max(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt2_s = 0;
SELECT max(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt3_s = 0;
SELECT max(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt4_s = 0;
SELECT max(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt5_s = 0;
SELECT min(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt1_s = 0;
SELECT min(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt2_s = 0;
SELECT min(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt3_s = 0;
SELECT min(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt4_s = 0;
SELECT min(time_id)
INTO l_j_date
FROM pji_rm_res_f
WHERE person_id = p_person_id
and expenditure_organization_id = p_exp_org_id
and period_type_id = 1
and time_id between l_start_time and l_end_time
and available_res_count_bkt5_s = 0;
SELECT userenv('LANG') INTO l_User_Lang FROM dual;
SELECT userenv('LANG') INTO l_User_Lang FROM dual;
SELECT value, start_date
FROM fii_time_week_v
WHERE l_is_date between start_date and end_date;
select start_date
into l_start_date
from fii_time_week_v
where value = p_week;
SELECT value, start_date
FROM fii_time_week_v
WHERE l_is_date between start_date and end_date;
select week_id, week_start_date
into l_week_id, l_week_date
from fii_time_day
where report_date = l_date; */
select start_date
into l_start_date
from fii_time_week_v
where value = p_week;
select name
into l_val_from
from fii_time_ent_year
where start_date = l_from_date;
select name
into l_val_to
from fii_time_ent_year
where end_date = l_to_date;
select name
into l_val_from
from fii_time_ent_qtr
where start_date = l_from_date;
select name
into l_val_to
from fii_time_ent_qtr
where end_date = l_to_date;
select name
into l_val_from
from fii_time_ent_period
where start_date = l_from_date;
select name
into l_val_to
from fii_time_ent_period
where end_date = l_to_date;
select name
into l_val_from
from fii_time_week
where start_date = l_from_date;
select name
into l_val_to
from fii_time_week
where end_date = l_to_date;
select value
into l_val_from
from fii_time_cal_period_v
where start_date = l_from_date;
select value
into l_val_to
from fii_time_cal_period_v
where end_date = l_to_date;
x_insert_top_org_flag OUT nocopy VARCHAR2 )
IS
l_security_profile_id per_security_profiles.security_profile_id%TYPE;
SELECT organization_id,
view_all_organizations_flag ,
include_top_organization_flag
INTO l_top_organization_id,
l_view_all_org_flag,
x_insert_top_org_flag
FROM per_security_profiles
WHERE security_profile_id=l_security_profile_id;
SELECT per.organization_id
INTO l_top_organization_id
FROM fnd_user fndu,
per_all_assignments_f per
WHERE fndu.user_id=l_user_id
AND fndu.employee_id=per.person_id
AND per.primary_flag='Y'
AND (SYSDATE BETWEEN per.effective_start_Date AND NVL(per.effective_end_date, SYSDATE + 1));
IF x_insert_top_org_flag = 'Y' THEN
SELECT name
INTO x_top_org_name
FROM hr_all_organization_units_tl
WHERE organization_id = x_top_org_id
AND language = USERENV('LANG');
x_insert_top_org_flag:='N';
l_insert_top_org_flag VARCHAR2(1);
x_insert_top_org_flag => l_insert_top_org_flag);
SELECT
PJI_ORGANIZATION_LIST(
orgd.organization_id_child
, org.name
, orgd.organization_id_parent)
BULK COLLECT INTO l_Organization_List
FROM
per_org_structure_elements orgd
, pji_system_settings pset
, hr_all_organization_units_tl org
WHERE 1=1
AND orgd.org_structure_version_id = pset.org_structure_version_id
AND orgd.organization_id_child = org.organization_id
AND org.language = USERENV('LANG');
SELECT
PJI_ORGANIZATION_LIST(
orgd.organization_id_child
, org.name
, orgd.organization_id_parent)
BULK COLLECT INTO l_Organization_List
FROM
per_org_structure_elements orgd
, pji_system_settings pset
, per_organization_list sec
, hr_all_organization_units_tl org
WHERE 1=1
AND orgd.org_structure_version_id = pset.org_structure_version_id
AND orgd.organization_id_child = org.organization_id
AND org.language = USERENV('LANG')
AND orgd.organization_id_child = sec.organization_id
AND sec.security_profile_id = fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL');
SELECT
PJI_ORGANIZATION_LIST(
orgd.organization_id_child
, org.name
, orgd.organization_id_parent)
BULK COLLECT INTO l_Organization_List
FROM
per_org_structure_elements orgd
, pji_system_settings pset
, hr_all_organization_units_tl org
WHERE 1=1
AND orgd.org_structure_version_id = pset.org_structure_version_id
AND orgd.organization_id_child = org.organization_id
AND org.language = USERENV('LANG')
START WITH orgd.organization_id_parent=l_top_organization_id
CONNECT BY PRIOR orgd.organization_id_child = orgd.organization_id_parent;
IF l_insert_top_org_flag= 'Y' THEN
--Bug 4599990.In case the user has permissions to see all the orgz then the top org has to be derived.
IF l_top_organization_id=0 THEN
FOR cur_Top_Organization_List IN (
SELECT
orgd.organization_id_child organization_id_child
, org.name name
, orgd.organization_id_parent organization_id_parent
FROM
(select distinct organization_id_parent organization_id_child, NULL organization_id_parent from
per_org_structure_elements p
, pji_system_settings pset
where p.org_structure_version_id = pset.org_structure_version_id
and not exists
(select 1 from
per_org_structure_elements c
where c.organization_id_child = p.organization_id_parent
and c.org_structure_version_id = p.org_structure_version_id)) orgd
, per_organization_list sec
, hr_all_organization_units_tl org
, per_security_profiles prof
WHERE 1=1
AND orgd.organization_id_child = org.organization_id
AND org.language = USERENV('LANG')
AND orgd.organization_id_child = sec.organization_id (+)
AND sec.security_profile_id(+) = fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL')
AND fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL') IS NOT NULL
AND prof.security_profile_id = fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL')
AND ( prof.view_all_organizations_flag = 'Y'
OR sec.organization_id IS NOT NULL))
LOOP
l_Count:=l_Count+1;
END IF;--IF l_insert_top_org_flag= 'Y' THEN
l_insert_top_org_flag VARCHAR2(1);
x_insert_top_org_flag => l_insert_top_org_flag);
SELECT p_org_id INTO l_org_id FROM DUAL WHERE EXISTS
(SELECT orgd.organization_id_child
FROM
per_org_structure_elements orgd
, pji_system_settings pset
, hr_all_organization_units org
WHERE 1=1
AND orgd.org_structure_version_id = pset.org_structure_version_id
AND orgd.organization_id_child = org.organization_id
AND org.organization_id = p_org_id);
SELECT p_org_id INTO l_org_id FROM DUAL WHERE EXISTS
(SELECT orgd.organization_id_child
FROM
per_org_structure_elements orgd
, pji_system_settings pset
, per_organization_list sec
, hr_all_organization_units org
WHERE 1=1
AND orgd.org_structure_version_id = pset.org_structure_version_id
AND orgd.organization_id_child = org.organization_id
AND org.organization_id = p_org_id
AND orgd.organization_id_child = sec.organization_id
AND sec.security_profile_id = fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL'));
SELECT p_org_id INTO l_org_id FROM DUAL WHERE EXISTS
(SELECT orgd.organization_id_child
FROM
per_org_structure_elements orgd
, pji_system_settings pset
, hr_all_organization_units org
WHERE 1=1
AND orgd.org_structure_version_id = pset.org_structure_version_id
AND orgd.organization_id_child = org.organization_id
AND orgd.organization_id_child = p_org_id
START WITH orgd.organization_id_parent=l_top_organization_id
CONNECT BY PRIOR orgd.organization_id_child = orgd.organization_id_parent);
IF l_insert_top_org_flag= 'Y' THEN
--Bug 4599990.In case the user has permissions to see all the orgz then the top org has to be derived.
IF l_top_organization_id=0 THEN
SELECT p_org_id INTO l_org_id FROM DUAL WHERE EXISTS
(SELECT orgd.organization_id_child
FROM
(select distinct organization_id_parent organization_id_child, NULL organization_id_parent from
per_org_structure_elements p
, pji_system_settings pset
where p.org_structure_version_id = pset.org_structure_version_id
and not exists
(select 1 from
per_org_structure_elements c
where c.organization_id_child = p.organization_id_parent
and c.org_structure_version_id = p.org_structure_version_id)) orgd
, per_organization_list sec
, hr_all_organization_units org
, per_security_profiles prof
WHERE 1=1
AND orgd.organization_id_child = org.organization_id
AND orgd.organization_id_child = p_org_id
AND orgd.organization_id_child = sec.organization_id (+)
AND sec.security_profile_id(+) = fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL')
AND fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL') IS NOT NULL
AND prof.security_profile_id = fnd_profile.value('PJI_SECURITY_PROFILE_LEVEL')
AND ( prof.view_all_organizations_flag = 'Y' OR sec.organization_id IS NOT NULL));
END IF;--IF l_insert_top_org_flag= 'Y' THEN
SELECT resource_job_level
INTO l_job_level
FROM pa_resources_denorm
WHERE person_id = p_person_id
AND p_as_of_date between resource_effective_start_date and resource_effective_end_date;
SELECT userenv('LANG')
INTO G_User_Lang
FROM dual;
SELECT lookup_code, meaning
BULK COLLECT INTO G_Measure_Short_Code, G_Measure_Label
FROM pji_lookups
WHERE lookup_type LIKE 'PJI_PMV_MSR_LABELS';
SELECT setup.report_labor_units
INTO G_FTE_Level
FROM pji_system_settings setup;
SELECT meaning INTO G_Budget_Label
FROM pji_lookups
WHERE lookup_type = G_Graph_Labels_LT
AND lookup_code = G_Budget_Label_LC ;
SELECT meaning INTO G_Prior_Label
FROM pji_lookups
WHERE lookup_type = G_Graph_Labels_LT
AND lookup_code = G_Prior_Budget_Label_LC ;