The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE insert_entry_lines(
p_run_name VARCHAR2,
p_hierarchy_id NUMBER,
p_entity_id NUMBER,
p_currency_code VARCHAR2,
p_bal_by_org VARCHAR2,
p_sec_track_col VARCHAR2,
p_is_elim_entity VARCHAR2,
p_cons_entity_id NUMBER,
p_re_template GCS_TEMPLATES_PKG.TemplateRecord,
p_cross_year_flag VARCHAR2,
p_category_code VARCHAR2,
p_init_entry_id NUMBER,
p_init_xlate_entry_id NUMBER,
p_init_stat_entry_id NUMBER,
p_recur_entry_id NUMBER,
p_recur_xlate_entry_id NUMBER,
p_recur_stat_entry_id NUMBER,
--Bugfix 5449718: Added the calendar period year and net to re flag as parameters
p_cal_period_year NUMBER,
p_net_to_re_flag VARCHAR2)
IS
fn_name VARCHAR2(30) := ''INSERT_ENTRY_LINES'';
SELECT NVL(gcerd.entry_id, gcerd.stat_entry_id),
geh.year_to_apply_re,
geh.currency_code,
''N'',
0
BULK COLLECT INTO
l_entry_id_list
FROM gcs_cons_eng_run_dtls gcerd,
gcs_entry_headers geh
WHERE gcerd.run_name = p_run_name
AND gcerd.consolidation_entity_id = p_cons_entity_id
AND gcerd.child_entity_id IS NOT NULL
AND gcerd.category_code = p_category_code
AND gcerd.entry_id = geh.entry_id
AND geh.period_init_entry_flag = ''N''
AND p_cal_period_year < NVL(geh.year_to_apply_re, p_cal_period_year+1);
SELECT NVL(gcerd.entry_id, gcerd.stat_entry_id),
geh.year_to_apply_re,
geh.currency_code,
''N'',
0
BULK COLLECT INTO
l_entry_id_list
FROM gcs_cons_eng_run_dtls gcerd,
gcs_entry_headers geh
WHERE gcerd.run_name = p_run_name
AND gcerd.consolidation_entity_id = p_cons_entity_id
AND gcerd.child_entity_id IS NOT NULL
AND gcerd.category_code = p_category_code
AND gcerd.entry_id = geh.entry_id
AND geh.period_init_entry_flag = ''N'';
SELECT NVL(gcerd.entry_id, gcerd.stat_entry_id),
geh.year_to_apply_re,
geh.currency_code,
geh.period_init_entry_flag,
NVL(geh.end_cal_period_id, geh.start_cal_period_id) - geh.start_cal_period_id
BULK COLLECT INTO
l_entry_id_list
FROM gcs_cons_eng_run_dtls gcerd,
gcs_entry_headers geh
WHERE gcerd.run_name = p_run_name
AND gcerd.consolidation_entity_id = p_cons_entity_id
AND gcerd.child_entity_id IS NOT NULL
AND gcerd.category_code = p_category_code
AND gcerd.entry_id = geh.entry_id;
SELECT NVL(gcerd.entry_id, gcerd.stat_entry_id),
geh.year_to_apply_re,
geh.currency_code,
''N'',
0
BULK COLLECT INTO
l_entry_id_list
FROM gcs_cons_eng_run_dtls gcerd,
gcs_entry_headers geh
WHERE gcerd.run_name = p_run_name
AND gcerd.consolidation_entity_id = p_cons_entity_id
AND gcerd.child_entity_id = p_entity_id
AND gcerd.category_code = p_category_code
AND gcerd.entry_id = geh.entry_id
AND geh.period_init_entry_flag = ''N''
AND p_cal_period_year < NVL(geh.year_to_apply_re, p_cal_period_year+1);
SELECT NVL(gcerd.entry_id, gcerd.stat_entry_id),
geh.year_to_apply_re,
geh.currency_code,
''N'',
0
BULK COLLECT INTO
l_entry_id_list
FROM gcs_cons_eng_run_dtls gcerd,
gcs_entry_headers geh
WHERE gcerd.run_name = p_run_name
AND gcerd.consolidation_entity_id = p_cons_entity_id
AND gcerd.child_entity_id = p_entity_id
AND gcerd.category_code = p_category_code
AND gcerd.entry_id = geh.entry_id
AND geh.period_init_entry_flag = ''N'';
SELECT NVL(gcerd.entry_id, gcerd.stat_entry_id),
geh.year_to_apply_re,
geh.currency_code,
geh.period_init_entry_flag,
NVL(geh.end_cal_period_id, geh.start_cal_period_id) - geh.start_cal_period_id
BULK COLLECT INTO
l_entry_id_list
FROM gcs_cons_eng_run_dtls gcerd,
gcs_entry_headers geh
WHERE gcerd.run_name = p_run_name
AND gcerd.consolidation_entity_id = p_cons_entity_id
AND gcerd.child_entity_id = p_entity_id
AND gcerd.category_code = p_category_code
AND gcerd.entry_id = geh.entry_id;
l_entry_id_list.DELETE(i);
l_entry_id_list.DELETE(i);
l_entry_list.DELETE;
l_currency_code_list.DELETE;
INSERT INTO GCS_ENTRY_LINES_GT
(entry_id,
description,
company_cost_center_org_id,
intercompany_id,
line_item_id,
';
SELECT
--Bugfix 5449718: Remove the references to the init_xlate_entry_id, and removed all group by calcs as this is happening on a line by line basis.
--Also remove join to gcs_entry_headers as all of the information is available in the PL/SQL collection
decode(l_currency_code_list(i), ''STAT'', p_init_stat_entry_id,
p_init_entry_id),
decode(feata.dim_attribute_varchar_member,
''REVENUE'', ''PROFIT_LOSS'',
''EXPENSE'', ''PROFIT_LOSS'',
''BALANCE_SHEET''),
l2.company_cost_center_org_id,
l2.intercompany_id,
l2.line_item_id,
';
l_entry_list.DELETE;
l_currency_code_list.DELETE;
INSERT INTO GCS_ENTRY_LINES_GT l1
(entry_id,
description,
company_cost_center_org_id,
intercompany_id,
line_item_id,
';
SELECT
--Bugfix 5449718: Remove the references to the init_xlate_entry_id, and removed all group by calcs as this is happening on a line by line basis.
--Also remove join to gcs_entry_headers as all of the information is available in the PL/SQL collection
--Join to line type is no longer required as all rows for recurring entries have the line type code populated
decode(l_currency_code_list(i), ''STAT'', p_init_stat_entry_id,
p_init_entry_id),
l2.line_type_code,
l2.company_cost_center_org_id,
l2.intercompany_id,
l2.line_item_id,
';
SELECT specific_intercompany_id
INTO l_intercompany_id
FROM GCS_CATEGORIES_B
WHERE category_code = ''INTRACOMPANY'';
l_entry_list.DELETE;
l_currency_code_list.DELETE;
INSERT INTO GCS_ENTRY_LINES_GT l1
(entry_id,
description,
company_cost_center_org_id,
intercompany_id,
line_item_id,
';
SELECT
--Bugfix 5449718: No longer need the target entries
decode(l_currency_code_list(i), ''STAT'', p_init_stat_entry_id,
p_init_entry_id),
''BALANCE_SHEET'',
';
SELECT specific_intercompany_id
INTO l_intercompany_id
FROM GCS_CATEGORIES_B
WHERE category_code = ''INTRACOMPANY'';
l_entry_list.DELETE;
l_currency_code_list.DELETE;
INSERT INTO GCS_ENTRY_LINES_GT l1
(entry_id,
description,
company_cost_center_org_id,
intercompany_id,
line_item_id,
';
SELECT
--Bugfix 5449718: No longer need the target entries
decode(l_currency_code_list(i), ''STAT'', p_recur_stat_entry_id,
p_recur_entry_id),
''BALANCE_SHEET'',
';
l_entry_list.DELETE;
l_currency_code_list.DELETE;
INSERT INTO GCS_ENTRY_LINES_GT l1
(entry_id,
description,
company_cost_center_org_id,
intercompany_id,
line_item_id,
';
SELECT
--Bugfix 5449718: No longer need the target entries
decode(l_currency_code_list(i), ''STAT'', p_recur_stat_entry_id,
p_recur_entry_id),
''BALANCE_SHEET'',
l2.company_cost_center_org_id,
l2.intercompany_id,
l2.line_item_id,
';
INSERT INTO gcs_entry_lines
(entry_id,
line_type_code,
company_cost_center_org_id,
intercompany_id,
line_item_id,
';
last_update_date,
last_updated_by,
last_update_login)
SELECT
entry_id,
MIN(description),
company_cost_center_org_id,
intercompany_id,
line_item_id,
';
''Inserted '' || to_char(SQL%ROWCOUNT) || '' row(s)'');
END insert_entry_lines;