The following lines contain the word 'select', 'insert', 'update' or 'delete':
select proj_fp_options_id,fin_plan_version_id,pfo.project_id,
fin_plan_option_level_code,cost_time_phased_code,fin_plan_preference_code preference_code,
revenue_time_phased_code,all_time_phased_code,cost_period_mask_id,
rev_period_mask_id,all_period_mask_id,decode(revenue_time_phased_code,'G',1,'P',2,
decode(cost_time_phased_code,'G',1,'P',2,
decode(all_time_phased_code,'G',1,'P',2,null))) time_phased_code,
decode(all_resource_list_id,null,decode(cost_resource_list_id,null,revenue_resource_list_id,cost_resource_list_id),all_resource_list_id) resource_list_id
from pa_proj_fp_options pfo
,pa_budget_versions pbv
where pfo.project_id = c_project_id
and pbv.budget_version_id=c_budget_version_id
and (fin_plan_version_id = c_budget_version_id OR
(pfo.project_id = p_project_id AND
fin_plan_option_level_code <> 'PLAN_VERSION' AND
nvl(pfo.fin_plan_type_id,-99)=nvl(pbv.fin_plan_type_id,-99))); /* So that the fetch/update is not done if project/plan type level record is already upgraded */
select migrated_rbs_version_id,uncategorized_flag from
pa_resource_lists_all_bg
where resource_list_id = c_resource_list_id;
select period_mask_id,decode(time_phase_code,'G',1,'P',2)time_phase_code
from pa_period_masks_b where pre_defined_flag='Y';
SELECT RBS_HEADER_ID
FROM pa_rbs_versions_b
WHERE RBS_VERSION_ID = c_rbs_version_id;
SELECT start_date, nvl(org_id,-99)
INTO l_project_start_date, l_org_id
FROM pa_projects_all
WHERE project_id = l_get_fin_plan_ver_csr.project_id;
SELECT min(start_date)
INTO l_project_start_date
FROM pa_budget_lines
WHERE budget_version_id = l_get_fin_plan_ver_csr.fin_plan_version_id;
select trunc(sysdate) into l_project_start_date from dual;
SELECT sob.accounted_period_type
INTO l_GL_period_type
FROM pa_implementations_all I
, gl_sets_of_books sob
WHERE nvl(i.org_id,-99) = l_org_id
AND sob.set_of_books_id = i.set_of_books_id;
SELECT gl.PERIOD_NAME
INTO l_curr_plan_period
FROM gl_periods gl
, pa_implementations_all i
, gl_sets_of_books sob
WHERE nvl(i.org_id,-99) = l_org_id
AND gl.period_type = l_GL_period_type
and l_project_start_date between gl.START_DATE and gl.END_DATE
AND sob.set_of_books_id = i.set_of_books_id
AND gl.period_set_name = sob.period_set_name
AND gl.ADJUSTMENT_PERIOD_FLAG = 'N';
SELECT i.pa_period_type
INTO l_PA_period_type
FROM pa_implementations_all i
WHERE nvl(i.org_id,-99) = l_org_id;
SELECT gl.PERIOD_NAME
INTO l_curr_plan_period
FROM gl_periods gl
, pa_implementations_all i
, gl_sets_of_books sob
WHERE nvl(i.org_id,-99) = l_org_id
AND gl.period_type = l_PA_period_type
and l_project_start_date between gl.START_DATE and gl.END_DATE
AND sob.set_of_books_id = i.set_of_books_id
AND gl.period_set_name = sob.period_set_name
AND gl.ADJUSTMENT_PERIOD_FLAG = 'N';
pa_debug.g_err_stage := 'Update Pa_proj_fp_options Table.';
update pa_proj_fp_options
SET cost_current_planning_period = l_cost_current_planning_period,
cost_period_mask_id = l_cost_period_mask_id,
rev_current_planning_period = l_rev_current_planning_period,
rev_period_mask_id = l_rev_period_mask_id,
all_current_planning_period = l_all_current_planning_period ,
all_period_mask_id = l_all_period_mask_id,
rbs_version_id = l_rbs_version_id, /* Rbs upgrade happens based on cost resource list id in case of cost and rev sep pref code */
all_FIN_PLAN_LEVEL_CODE = decode(all_FIN_PLAN_LEVEL_CODE, 'M', 'L', all_FIN_PLAN_LEVEL_CODE), /* bug 3820552 */
cost_FIN_PLAN_LEVEL_CODE = decode(cost_FIN_PLAN_LEVEL_CODE, 'M', 'L', cost_FIN_PLAN_LEVEL_CODE), /* bug 3820552 */
revenue_FIN_PLAN_LEVEL_CODE = decode(revenue_FIN_PLAN_LEVEL_CODE, 'M', 'L', revenue_FIN_PLAN_LEVEL_CODE), /* bug 3820552 */
use_planning_rates_flag = 'N'
where proj_fp_options_id = l_get_fin_plan_ver_csr.proj_fp_options_id;
pa_debug.g_err_stage := 'Update Pa_Budget_versions Table.';
update pa_budget_versions
set project_structure_version_id = NULL,
object_type_code = 'PROJECT',
object_id = l_get_fin_plan_ver_csr.project_id,
pji_summarized_flag = 'N',
current_planning_period = l_curr_plan_period,
period_mask_id = l_period_mask_id,
wp_version_flag = 'N' /* Bug 3799921: added this column */
where budget_version_id = l_get_fin_plan_ver_csr.fin_plan_version_id;