The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT min(entry_id), decode(min(entry_id), NULL, 'N', 'Y')
FROM GCS_ENTRY_HEADERS
WHERE hierarchy_id = p_hierarchy_id
AND entity_id = c_entity_id
AND currency_code = p_currency_code
AND balance_type_code = p_balance_type_code
AND start_cal_period_id = p_start_cal_period_id
AND nvl(end_cal_period_id, -1) = nvl(p_end_cal_period_id, -1)
AND category_code = p_category_code
AND period_init_entry_flag = 'Y';
SELECT target_entity_code
INTO l_target_entity_code
FROM gcs_categories_b
WHERE category_code = p_category_code;
SELECT nvl(decode(dim_attribute_varchar_member, 'E', 'Y', 'N'), 'N')
INTO l_is_elim_entity
FROM FEM_ENTITIES_ATTR
WHERE attribute_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-ENTITY_TYPE_CODE').attribute_id
AND version_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-ENTITY_TYPE_CODE').version_id
AND entity_id = p_entity_id
AND value_set_id = GCS_UTILITY_PKG.g_gcs_dimension_info
('ENTITY_ID').associated_value_set_id;
SELECT oper_fea.dim_attribute_numeric_member
INTO l_query_entity_id
FROM fem_entities_attr oper_fea,
fem_entities_attr elim_fea
WHERE elim_fea.attribute_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-ELIMINATION_ENTITY').attribute_id
AND elim_fea.version_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-ELIMINATION_ENTITY').version_id
AND elim_fea.value_set_id = GCS_UTILITY_PKG.g_gcs_dimension_info
('ENTITY_ID').associated_value_set_id
AND elim_fea.dim_attribute_numeric_member = p_entity_id
AND oper_fea.entity_id = elim_fea.entity_id
AND oper_fea.attribute_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-OPERATING_ENTITY').attribute_id
AND oper_fea.version_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-OPERATING_ENTITY').version_id
AND oper_fea.value_set_id = GCS_UTILITY_PKG.g_gcs_dimension_info
('ENTITY_ID').associated_value_set_id;
DELETE FROM GCS_ENTRY_LINES
WHERE entry_id = l_entry_id;
SELECT lp.cal_period_id
FROM fem_cal_periods_b lp,
fem_cal_periods_b fp,
fem_cal_periods_attr lp_year,
fem_cal_periods_attr fp_year,
fem_cal_periods_attr lp_num
WHERE fp.cal_period_id = p_next_cal_period_id
AND lp.dimension_group_id = fp.dimension_group_id
AND lp.calendar_id = fp.calendar_id
AND lp_year.cal_period_id = lp.cal_period_id
AND lp_year.attribute_id = GCS_UTILITY_PKG.g_dimension_attr_info('CAL_PERIOD_ID-ACCOUNTING_YEAR').attribute_id
AND lp_year.version_id = GCS_UTILITY_PKG.g_dimension_attr_info('CAL_PERIOD_ID-ACCOUNTING_YEAR').version_id
AND fp_year.cal_period_id = fp.cal_period_id
AND fp_year.attribute_id = GCS_UTILITY_PKG.g_dimension_attr_info('CAL_PERIOD_ID-ACCOUNTING_YEAR').attribute_id
AND fp_year.version_id = GCS_UTILITY_PKG.g_dimension_attr_info('CAL_PERIOD_ID-ACCOUNTING_YEAR').version_id
AND lp_year.number_assign_value = fp_year.number_assign_value
AND lp_num.cal_period_id = lp.cal_period_id
AND lp_num.attribute_id = GCS_UTILITY_PKG.g_dimension_attr_info('CAL_PERIOD_ID-GL_PERIOD_NUM').attribute_id
AND lp_num.version_id = GCS_UTILITY_PKG.g_dimension_attr_info('CAL_PERIOD_ID-GL_PERIOD_NUM').version_id
ORDER BY lp_num.number_assign_value desc;
SELECT net_to_re_flag
INTO l_net_to_re_flag
FROM gcs_categories_b
WHERE category_code = l_category_code;
GCS_PERIOD_INIT_DYNAMIC_PKG.insert_entry_lines(p_run_name,
p_hierarchy_id,
p_entity_id,
p_currency_code,
p_bal_by_org_flag,
p_sec_track_col_name,
p_is_elim_entity,
p_cons_entity_id,
p_re_template,
p_cross_year_flag,
l_category_code,
l_init_entry_id,
l_init_xlate_entry_id,
l_init_stat_entry_id,
l_recur_entry_id,
l_recur_xlate_entry_id,
l_recur_stat_entry_id,
--Bugfix 5449718: Passing the calendar period year and net to re flag
p_cal_period_year,
l_net_to_re_flag);
SELECT currency_code
INTO l_entity_curr
FROM GCS_ENTITY_CONS_ATTRS
WHERE hierarchy_id = p_hierarchy_id
AND entity_id = p_entity_id;
SELECT currency_code
INTO l_cons_entity_curr
FROM GCS_ENTITY_CONS_ATTRS
WHERE hierarchy_id = p_hierarchy_id
AND entity_id = p_cons_entity_id;
SELECT balance_by_org_flag, column_name
INTO l_bal_by_org_flag, l_sec_track_col_name
FROM gcs_hierarchies_b
WHERE hierarchy_id = p_hierarchy_id;
SELECT nvl(decode(dim_attribute_varchar_member, 'E', 'Y', 'N'), 'N')
INTO l_is_elim_entity
FROM FEM_ENTITIES_ATTR
WHERE attribute_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-ENTITY_TYPE_CODE').attribute_id
AND version_id = GCS_UTILITY_PKG.g_dimension_attr_info
('ENTITY_ID-ENTITY_TYPE_CODE').version_id
AND entity_id = p_entity_id
AND value_set_id = GCS_UTILITY_PKG.g_gcs_dimension_info
('ENTITY_ID').associated_value_set_id;
SELECT gcb.category_code,
count(gcerd.stat_entry_id),
count(decode(gcb.net_to_re_flag, 'N', null, gcerd.entry_id)),
count(decode(gcb.net_to_re_flag, 'N', null, gcerd.stat_entry_id)),
min(gcb.net_to_re_flag)
BULK COLLECT INTO g_entry_info
FROM gcs_cons_eng_run_dtls gcerd,
gcs_categories_b gcb
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 = gcb.category_code
AND gcb.target_entity_code IN ('PARENT', 'ELIMINATION')
GROUP BY gcb.category_code;
SELECT gcb.category_code,
count(gcerd.stat_entry_id),
count(decode(gcb.net_to_re_flag, 'N', null, gcerd.entry_id)),
count(decode(gcb.net_to_re_flag, 'N', null, gcerd.stat_entry_id)),
min(gcb.net_to_re_flag)
BULK COLLECT INTO g_entry_info
FROM gcs_cons_eng_run_dtls gcerd,
gcs_categories_b gcb
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 = gcb.category_code
AND gcb.target_entity_code = 'CHILD'
--Bugfix 6037112
AND gcb.category_type_code <> 'PROCESS'
GROUP BY gcb.category_code;