The following lines contain the word 'select', 'insert', 'update' or 'delete':
(select detail_budgeting_allowed_flag, summary_flag
from gl_code_combinations
where code_combination_id = l_ccid
)
loop
if cc_rec.detail_budgeting_allowed_flag = 'N'
or cc_rec.summary_flag = 'Y' then
/* Bug 3692601 Start */
l_concat_segments := FND_FLEX_EXT.Get_Segs
(application_short_name => 'SQLGL',
key_flex_code => 'GL#',
structure_number => p_flex_code,
combination_id => l_ccid);
(select 1 from PSB_BUDGET_ACCOUNTS
where code_combination_id = p_code_combination_id)
LOOP
l_cc_in_ba_flag := FND_API.G_TRUE;
select sr.budget_group_id
from psb_set_relations_v sr,
psb_budget_accounts ba
where sr.budget_group_id in
(select budget_group_id
from PSB_BUDGET_GROUPS
where budget_group_type = 'R'
and (p_startdate_pp is null or effective_start_date <= p_startdate_pp)
and (effective_end_date is null or effective_end_date >= p_enddate_cy)
start with budget_group_id = p_parent_budget_group_id
connect by prior budget_group_id = parent_budget_group_id)
and sr.account_position_set_id = ba.account_position_set_id
and ba.code_combination_id = p_code_combination_id
)
LOOP
p_budget_group_id := ba_rec.budget_group_id;
SELECT 1
FROM PSB_BUDGET_ACCOUNTS
WHERE account_position_set_id = aps_id
AND code_combination_id = ccid;
SELECT aps.account_position_set_id, sr.budget_group_id
FROM psb_account_position_sets aps, psb_set_relations sr
WHERE sr.account_position_set_id = aps.account_position_set_id
and aps.account_or_position_type = 'A'
and sr.budget_group_id in (select budget_group_id
from PSB_BUDGET_GROUPS
where budget_group_type = 'R'
and effective_start_date <= p_startdate_pp
and (effective_end_date is null or effective_end_date >= p_enddate_cy)
start with budget_group_id = p_parent_budget_group_id
connect by prior budget_group_id = parent_budget_group_id)
)
LOOP
--dbms_output.put_line(' bg : ' || to_char(l_set_rec.budget_group_id)
-- || ' aps :'||to_char(l_set_rec.account_position_set_id));
INSERT INTO psb_budget_accounts(
account_position_set_id,
set_of_books_id,
code_combination_id,
last_update_date,
last_updated_by,
last_update_login,
created_by,
creation_date) values
(l_set_rec.account_position_set_id,
p_set_of_books_id,
p_code_combination_id,
g_current_date,
g_current_user_id,
g_current_login_id,
g_current_user_id,
g_current_date);
SELECT nvl(root_budget_group_id, budget_group_id) root_budget_group_id
FROM psb_budget_groups_v
WHERE budget_group_id = p_parent_budget_group_id
)
LOOP
l_root_budget_group_id := l_bg_rec.root_budget_group_id;
SELECT aps.account_position_set_id, bg.budget_group_id
FROM psb_account_position_sets aps, psb_budget_groups bg
WHERE bg.budget_group_id = l_root_budget_group_id
AND aps.account_position_set_id IN
( bg.ps_account_position_set_id, bg.nps_account_position_set_id)
)
LOOP
IF Check_APS(l_set_rec.account_position_set_id,
p_code_combination_id
) THEN
-- create record in budget accounts table only if flag is on
IF p_create_budget_account = FND_API.G_TRUE then
INSERT INTO psb_budget_accounts(
account_position_set_id,
set_of_books_id,
code_combination_id,
last_update_date,
last_updated_by,
last_update_login,
created_by,
creation_date) values
(l_set_rec.account_position_set_id,
p_set_of_books_id,
p_code_combination_id,
g_current_date,
g_current_user_id,
g_current_login_id,
g_current_user_id,
g_current_date);
SELECT worksheet_id, w.allocrule_set_id , sr.account_position_set_id,
sr.allocation_rule_id, pe.name ,pea.entity_set_id, pea.entity_id,
pe.entity_subtype,
pe.allocation_type
FROM psb_worksheets w,
psb_entity_assignment pea,
psb_entity pe,
psb_set_relations sr
WHERE pe.entity_type = 'ALLOCRULE'
AND pea.entity_set_id = w.allocrule_set_id
AND pea.entity_id = pe.entity_id
AND sr.allocation_rule_id = pea.entity_id
AND worksheet_id = p_worksheet_id
)
LOOP
/*For Bug No 2026323 Start*/
l_ccid_exists := FALSE;
INSERT INTO psb_budget_accounts(
account_position_set_id,
set_of_books_id,
code_combination_id,
last_update_date,
last_updated_by,
last_update_login,
created_by,
creation_date) values
(alloc_aps_rec.account_position_set_id,
p_set_of_books_id,
p_code_combination_id,
g_current_date,
g_current_user_id,
g_current_login_id,
g_current_user_id,
g_current_date);
SELECT line_sequence_id, include_or_exclude_type
FROM psb_account_position_set_lines
WHERE account_position_set_id = p_aps_id
and include_or_exclude_type = 'E'
)
LOOP
--
IF Check_Account_Line(l_line_e_rec.line_sequence_id,
p_code_combination_id
) THEN
l_excluded_flag := FND_API.G_TRUE;
SELECT line_sequence_id, include_or_exclude_type
FROM psb_account_position_set_lines
WHERE account_position_set_id = p_aps_id
and include_or_exclude_type = 'I'
)
LOOP
--
IF Check_Account_Line(l_line_i_rec.line_sequence_id,
p_code_combination_id
) THEN
l_included_flag := FND_API.G_TRUE;
l_sql := ' SELECT count(*) FROM gl_code_combinations glcc, ' ||
' psb_account_position_set_lines apsl ' ||
' WHERE glcc.code_combination_id = :ccid ' ||
' AND apsl.line_sequence_id = :line_sequence_id ' ||
' AND glcc.enabled_flag = ''Y''' ||
' AND glcc.detail_budgeting_allowed_flag = ''Y''' ||
' AND glcc.template_id is null ' ;
SELECT seg.application_column_name
FROM fnd_id_flex_structures str, fnd_id_flex_segments seg
WHERE str.application_id = l_application_id -- bug #4924031
AND str.id_flex_code = l_id_flex_code -- bug #4924031
AND str.id_flex_num = p_chart_of_accounts_id
AND str.id_flex_code = seg.id_flex_code
AND str.id_flex_num = seg.id_flex_num
AND seg.enabled_flag = l_yes_flag -- bug #4924031
AND seg.application_id = str.application_id -- bug #4924031
)
LOOP
g_total_active_segments := g_total_active_segments + 1;