The following lines contain the word 'select', 'insert', 'update' or 'delete':
select 'Y'
from pa_budget_versions v,
pa_budget_entry_methods m,
pa_budget_types bt
where v.project_id = x_project_id
and v.budget_status_code = 'W'
and m.entry_level_code = p_entry_level
and m.time_phased_type_code='N'
and v.budget_entry_method_code = m.budget_entry_method_code
and v.budget_type_code = bt.budget_type_Code
and nvl(bt.plan_type,'BUDGET') = 'BUDGET'
UNION ALL
select 'Y'
from pa_budget_versions v
,pa_proj_fp_options fo
where v.project_id = x_project_id
and v.budget_version_id = fo.fin_plan_version_id
and (fo.all_time_phased_code = 'N'
OR fo.cost_time_phased_code = 'N'
OR fo.revenue_time_phased_code = 'N')
and (fo.all_fin_plan_level_code = p_entry_level
OR fo.cost_fin_plan_level_code = p_entry_level
OR fo.revenue_fin_plan_level_code = p_entry_level); */
select 'Y'
from pa_budget_versions v,
pa_budget_entry_methods m,
pa_budget_types bt
where v.project_id = x_project_id
and v.budget_status_code = 'W'
and m.entry_level_code = 'P'
and m.time_phased_type_code='N'
and v.budget_entry_method_code = m.budget_entry_method_code
and v.budget_type_code = bt.budget_type_Code
and nvl(bt.plan_type,'BUDGET') = 'BUDGET'
and nvl(v.wp_version_flag,'N') = 'N'
and 'X' = DECODE(l_baseline_funding, 'Y', DECODE(v.budget_type_code, 'AR', 'Z', 'X'), 'X') --Bug 5098809.
UNION ALL
select 'Y'
from pa_budget_versions v
,pa_proj_fp_options fo
where v.project_id = x_project_id
and v.budget_version_id = fo.fin_plan_version_id
and fo.project_id = v.project_id -- raja perf bug 3683360
and fo.fin_plan_type_id = v.fin_plan_type_id -- raja perf bug 3683360
and (fo.all_time_phased_code = 'N'
OR fo.cost_time_phased_code = 'N'
OR fo.revenue_time_phased_code = 'N')
and (fo.all_fin_plan_level_code = 'P'
OR fo.cost_fin_plan_level_code = 'P'
OR fo.revenue_fin_plan_level_code = 'P')
and nvl(v.wp_version_flag,'N') = 'N'
and 'X' = DECODE(l_baseline_funding, 'Y', DECODE(v.approved_rev_plan_type_flag, 'Y', 'Z', 'X'), 'X'); --Bug 5098809.
select 'Y'
from pa_budget_versions v,
pa_budget_entry_methods m,
pa_budget_types bt
where v.project_id = x_project_id
and v.budget_status_code = 'W'
and m.entry_level_code in ('T','L','M')
and m.time_phased_type_code='N'
and v.budget_entry_method_code = m.budget_entry_method_code
and v.budget_type_code = bt.budget_type_Code
and nvl(bt.plan_type,'BUDGET') = 'BUDGET'
and nvl(v.wp_version_flag,'N') = 'N'
and 'X' = DECODE(l_baseline_funding, 'Y', DECODE(v.budget_type_code, 'AR', 'Z', 'X'), 'X') --Bug 5098809.
UNION ALL
select 'Y'
from pa_budget_versions v
,pa_proj_fp_options fo
where v.project_id = x_project_id
and v.budget_version_id = fo.fin_plan_version_id
and fo.project_id = v.project_id -- raja perf bug 3683360
and fo.fin_plan_type_id = v.fin_plan_type_id -- raja perf bug 3683360
and (fo.all_time_phased_code = 'N'
OR fo.cost_time_phased_code = 'N'
OR fo.revenue_time_phased_code = 'N')
and (fo.all_fin_plan_level_code in ('T','L')
OR fo.cost_fin_plan_level_code in ('T','L')
OR fo.revenue_fin_plan_level_code in ('T','L'))
and nvl(v.wp_version_flag,'N') = 'N'
and 'X' = DECODE(l_baseline_funding, 'Y', DECODE(v.approved_rev_plan_type_flag, 'Y', 'Z', 'X'), 'X'); --Bug 5098809.
SELECT nvl(baseline_funding_flag, 'N')
INTO l_baseline_funding
FROM pa_projects_all
WHERE project_id = x_project_id;
UPDATE pa_budget_versions
SET budget_status_code = 'S'
WHERE budget_version_id = x_budget_version_id;
UPDATE pa_budget_versions
SET budget_status_code = 'W'
WHERE budget_version_id = x_budget_version_id;
select 1
from dual
where exists
(select 'x' /* Old budgets model */
from pa_budget_versions v,
pa_budget_entry_methods m,
pa_resource_assignments r
where r.task_id = x_task_id
and ( (m.entry_level_code = 'L')
or
(m.entry_level_code = 'M'
and x_task_id <> x_top_task_id)
)
and v.budget_entry_method_code = m.budget_entry_method_code
and v.budget_version_id = r.budget_version_id
and v.budget_type_code is not null
union all
select 'x' /* Org Forcast Versions */
from pa_budget_versions v,
pa_resource_assignments r,
pa_fin_plan_types_b pft
where r.task_id = x_task_id
and v.budget_type_code is null
and v.budget_version_id = r.budget_version_id
and v.fin_plan_type_id = pft.fin_plan_type_id
and pft.fin_plan_type_code = 'ORG_FORECAST');
select 'x' -- Financial plan versions
from pa_fp_elements fe
-- Bug 2993894 ,pa_budget_versions bv
where fe.task_id = x_task_id
-- Bug 2993894 and fe.fin_plan_version_id = bv.budget_version_id
and (x_task_id <> x_top_task_id OR fe.top_task_planning_level = 'LOWEST')); */
select 1
from dual
where exists
(select 'x' /* Old budgets model */
from pa_budget_versions v,
pa_budget_entry_methods m,
pa_resource_assignments r
where r.task_id = x_task_id
and ( (m.entry_level_code = 'L')
or
(m.entry_level_code = 'M'
and x_task_id <> x_top_task_id)
)
and v.budget_entry_method_code = m.budget_entry_method_code
and v.budget_version_id = r.budget_version_id
and v.budget_type_code is not null
union all
select 'x' /* Org Forcast Versions */
from pa_budget_versions v,
pa_resource_assignments r,
pa_fin_plan_types_b pft
where r.task_id = x_task_id
and v.budget_type_code is null
and v.budget_version_id = r.budget_version_id
and v.fin_plan_type_id = pft.fin_plan_type_id
and pft.fin_plan_type_code = 'ORG_FORECAST');
select 'x'-- Financial plan versions
from pa_fp_elements fe,
pa_budget_versions bv
where fe.task_id = x_task_id
and fe.fin_plan_version_id = bv.budget_version_id
and (fe.plan_amount_exists_flag = 'Y' or bv.budget_status_code = 'B')
and (x_task_id <> x_top_task_id OR fe.top_task_planning_level = 'LOWEST'));*/