The following lines contain the word 'select', 'insert', 'update' or 'delete':
StdInterimInsertStr VARCHAR2(2200);
StdInterimInsertStr :=
'INSERT INTO gl_efb_upgrade_std ' ||
'(ledger_id, code_combination_id, currency_code,' ||
' period_name, actual_flag, translated_flag,' ||
' period_net_dr_beq, period_net_cr_beq,' ||
' quarter_to_date_dr_beq, quarter_to_date_cr_beq,' ||
' begin_balance_dr_beq, begin_balance_cr_beq,' ||
' project_to_date_dr_beq, project_to_date_cr_beq,' ||
' template_id) '||
'SELECT ' || hint_txt ||
'b1.ledger_id, b1.code_combination_id, b1.currency_code, ' ||
'ps.period_name, b1.actual_flag, b1.translated_flag, ' ||
'sum(decode(b1.period_name, ps.period_name, b1.period_net_dr_beq,0)), ' ||
'sum(decode(b1.period_name, ps.period_name, b1.period_net_cr_beq,0)), ' ||
'sum(decode(p1.period_year, ps.period_year, ' ||
' decode(p1.quarter_num, ps.quarter_num, ' ||
' decode(p1.period_num, ps.period_num, 0, ' ||
' b1.period_net_dr_beq),0),0)), ' ||
'sum(decode(p1.period_year, ps.period_year, ' ||
' decode(p1.quarter_num, ps.quarter_num, ' ||
' decode(p1.period_num, ps.period_num, 0, ' ||
' b1.period_net_cr_beq),0),0)), ' ||
'sum(decode(b1.period_name, ps.period_name, b1.begin_balance_dr_beq,0)),'||
'sum(decode(b1.period_name, ps.period_name, b1.begin_balance_cr_beq,0)),'||
'sum(decode(p1.period_year, ps.period_year, ' ||
' decode(p1.period_num, ps.period_num, 0, ' ||
' b1.period_net_dr_beq), b1.period_net_dr_beq)), ' ||
'sum(decode(p1.period_year, ps.period_year, ' ||
' decode(p1.period_num, ps.period_num, 0, ' ||
' b1.period_net_cr_beq), b1.period_net_cr_beq)), ' ||
'b1.template_id ' ||
'FROM ' || x_src_table ||
' b1, gl_period_statuses p1, gl_period_statuses ps ' ||
'WHERE b1.actual_flag = ''A'' ' ||
'AND b1.currency_code <> ''STAT'' ' ||
'AND b1.translated_flag = ''R'' ' ||
ccid_range ||
'AND ps.ledger_id = b1.ledger_id ' ||
'AND ps.application_id = 101 ' ||
'AND ps.closing_status not in (''N'', ''F'') ' ||
'AND p1.effective_period_num <= ps.effective_period_num ' ||
'AND p1.ledger_id = b1.ledger_id ' ||
'AND p1.application_id = 101 ' ||
'AND p1.period_name = b1.period_name ' ||
'GROUP BY b1.ledger_id, b1.code_combination_id,b1.currency_code, ' ||
' b1.actual_flag, b1.translated_flag, b1.template_id, ps.period_name';
EXECUTE IMMEDIATE StdInterimInsertStr USING x_start_id, x_end_id;
EXECUTE IMMEDIATE StdInterimInsertStr;
PROCEDURE update_std_foreign_ent_bal(x_src_table VARCHAR2,
x_start_id NUMBER DEFAULT NULL,
x_end_id NUMBER DEFAULT NULL) IS
fn_name CONSTANT VARCHAR2(30) := 'UPDATE_STD_FOREIGN_ENT_BAL';
StdUpdateFrgnEntBalStr VARCHAR2(1000);
' (select code_combination_id, period_name ' ||
' from gl_efb_upgrade_std) ';
StdUpdateFrgnEntBalStr :=
'UPDATE ' || x_src_table || ' b1 ' ||
'SET (b1.quarter_to_date_dr_beq, b1.quarter_to_date_cr_beq, ' ||
' b1.project_to_date_dr_beq, b1.project_to_date_cr_beq) ' ||
' = (select /*+ INDEX (b2 gl_efb_upgrade_std_n1 ) */ b2.quarter_to_date_dr_beq, b2.quarter_to_date_cr_beq, ' ||
' b2.project_to_date_dr_beq, b2.project_to_date_cr_beq ' ||
' from gl_efb_upgrade_std b2 ' ||
' where b2.ledger_id = b1.ledger_id ' ||
' and b2.code_combination_id = b1.code_combination_id ' ||
' and b2.currency_code = b1.currency_code ' ||
' and b2.period_name = b1.period_name ' ||
' and b2.actual_flag = ''A'' ' ||
' and b2.translated_flag = ''R'') ' ||
'WHERE b1.translated_flag = ''R'' ' ||
'AND b1.actual_flag = ''A'' ' ||
bal_where_clause;
EXECUTE IMMEDIATE StdUpdateFrgnEntBalStr USING x_start_id, x_end_id;
EXECUTE IMMEDIATE StdUpdateFrgnEntBalStr;
END update_std_foreign_ent_bal;
PROCEDURE update_std_func_ent_bal(x_src_table VARCHAR2,
x_start_id NUMBER DEFAULT NULL,
x_end_id NUMBER DEFAULT NULL) IS
fn_name CONSTANT VARCHAR2(30) := 'UPDATE_STD_FUNC_ENT_BAL';
StdUpdateFuncEntBalStr VARCHAR2(1400);
StdUpdateFuncEntBalStr :=
'UPDATE ' || hint_txt || x_src_table || ' b1 ' ||
'SET (b1.period_net_dr_beq, b1.period_net_cr_beq, ' ||
' b1.begin_balance_dr_beq, b1.begin_balance_cr_beq, ' ||
' b1.quarter_to_date_dr_beq, b1.quarter_to_date_cr_beq, ' ||
' b1.project_to_date_dr_beq, b1.project_to_date_cr_beq) ' ||
' = (select /*+ INDEX (b2 gl_efb_upgrade_std_n1 ) */ ' ||
' (b1.period_net_dr - nvl(sum(b2.period_net_dr_beq),0)), ' ||
' (b1.period_net_cr - nvl(sum(b2.period_net_cr_beq),0)), ' ||
' (b1.begin_balance_dr - nvl(sum(b2.begin_balance_dr_beq),0)), ' ||
' (b1.begin_balance_cr - nvl(sum(b2.begin_balance_cr_beq),0)), ' ||
' (b1.quarter_to_date_dr - nvl(sum(b2.quarter_to_date_dr_beq),0)),'||
' (b1.quarter_to_date_cr - nvl(sum(b2.quarter_to_date_cr_beq),0)),'||
' (b1.project_to_date_dr - nvl(sum(b2.project_to_date_dr_beq),0)),'||
' (b1.project_to_date_cr - nvl(sum(b2.project_to_date_cr_beq),0)) '||
' from gl_efb_upgrade_std b2 ' ||
' where b2.period_name = b1.period_name ' ||
' and b2.ledger_id = b1.ledger_id ' ||
' and b2.actual_flag = ''A'' ' ||
' and b2.translated_flag = ''R'' ' ||
' and b2.code_combination_id = b1.code_combination_id) ' ||
'WHERE b1.currency_code <> ''STAT'' ' ||
'AND b1.actual_flag = ''A'' ' ||
ccid_range ||
'AND b1.translated_flag IS NULL ' ||
'AND b1.currency_code = ' ||
' (select currency_code ' ||
' from gl_ledgers ' ||
' where ledger_id = b1.ledger_id)';
EXECUTE IMMEDIATE StdUpdateFuncEntBalStr USING x_start_id, x_end_id;
EXECUTE IMMEDIATE StdUpdateFuncEntBalStr;
END update_std_func_ent_bal;
AdbInterimInsertStr VARCHAR2(8000);
AdbInterimInsertStr :=
'INSERT INTO gl_efb_upgrade_adb ' ||
'(ledger_id, code_combination_id, currency_code,' ||
' period_name, period_start_date, period_end_date,' ||
' quarter_start_date, year_start_date,'||
' period_type, period_year, period_num, template_id,' ||
' opening_period_aggregate,' ||
' opening_quarter_aggregate,' ||
' opening_year_aggregate,' ||
' period_aggregate1, period_aggregate2, period_aggregate3,'||
' period_aggregate4, period_aggregate5, period_aggregate6,' ||
' period_aggregate7, period_aggregate8, period_aggregate9,' ||
' period_aggregate10, period_aggregate11, period_aggregate12,' ||
' period_aggregate13, period_aggregate14, period_aggregate15,' ||
' period_aggregate16, period_aggregate17, period_aggregate18,' ||
' period_aggregate19, period_aggregate20, period_aggregate21,' ||
' period_aggregate22, period_aggregate23, period_aggregate24,' ||
' period_aggregate25, period_aggregate26, period_aggregate27,' ||
' period_aggregate28, period_aggregate29, period_aggregate30,' ||
' period_aggregate31, period_aggregate32, period_aggregate33,' ||
' period_aggregate34, period_aggregate35) ' ||
'SELECT ' ||
'b1.ledger_id, b1.code_combination_id, max(ldg.currency_code), ' ||
'b1.period_name, max(b1.period_start_date), max(b1.period_end_date), ' ||
'max(b1.quarter_start_date), max(b1.year_start_date), ' ||
'max(b1.period_type), max(b1.period_year), max(b1.period_num), ' ||
'b1.template_id, ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.opening_period_aggregate,' ||
' ''C'', -b1.opening_period_aggregate,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.opening_quarter_aggregate,' ||
' ''C'', -b1.opening_quarter_aggregate,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.opening_year_aggregate,'||
' ''C'', -b1.opening_year_aggregate,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate1,' ||
' ''C'', -b1.period_aggregate1,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate2,' ||
' ''C'', -b1.period_aggregate2,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate3,' ||
' ''C'', -b1.period_aggregate3,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate4,' ||
' ''C'', -b1.period_aggregate4,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate5,' ||
' ''C'', -b1.period_aggregate5,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate6,' ||
' ''C'', -b1.period_aggregate6,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate7,' ||
' ''C'', -b1.period_aggregate7,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate8,' ||
' ''C'', -b1.period_aggregate8,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate9,' ||
' ''C'', -b1.period_aggregate9,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate10,' ||
' ''C'', -b1.period_aggregate10,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate11,' ||
' ''C'', -b1.period_aggregate11,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate12,' ||
' ''C'', -b1.period_aggregate12,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate13,' ||
' ''C'', -b1.period_aggregate13,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate14,' ||
' ''C'', -b1.period_aggregate14,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate15,' ||
' ''C'', -b1.period_aggregate15,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate16,' ||
' ''C'', -b1.period_aggregate16,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate17,' ||
' ''C'', -b1.period_aggregate17,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate18,' ||
' ''C'', -b1.period_aggregate18,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate19,' ||
' ''C'', -b1.period_aggregate19,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate20,' ||
' ''C'', -b1.period_aggregate20,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate21,' ||
' ''C'', -b1.period_aggregate21,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate22,' ||
' ''C'', -b1.period_aggregate22,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate23,' ||
' ''C'', -b1.period_aggregate23,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate24,' ||
' ''C'', -b1.period_aggregate24,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate25,' ||
' ''C'', -b1.period_aggregate25,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate26,' ||
' ''C'', -b1.period_aggregate26,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate27,' ||
' ''C'', -b1.period_aggregate27,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate28,' ||
' ''C'', -b1.period_aggregate28,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate29,' ||
' ''C'', -b1.period_aggregate29,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate30,' ||
' ''C'', -b1.period_aggregate30,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate31,' ||
' ''C'', -b1.period_aggregate31,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate32,' ||
' ''C'', -b1.period_aggregate32,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate33,' ||
' ''C'', -b1.period_aggregate33,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate34,' ||
' ''C'', -b1.period_aggregate34,0),0)), ' ||
'sum(decode(b1.currency_code, ldg.currency_code,' ||
' decode(b1.currency_type, ''U'', b1.period_aggregate35,' ||
' ''C'', -b1.period_aggregate35,0),0)) ' ||
'FROM ' || x_src_table || ' b1, gl_ledgers ldg ' ||
'WHERE ldg.ledger_id = b1.ledger_id ' ||
'AND ldg.currency_code = b1.currency_code ' ||
'AND ldg.enable_average_balances_flag = ''Y'' ' ||
'AND b1.actual_flag = ''A'' ' ||
ccid_range ||
'GROUP BY b1.ledger_id, b1.code_combination_id, ' ||
' b1.period_name, b1.template_id';
EXECUTE IMMEDIATE AdbInterimInsertStr USING x_start_id, x_end_id;
EXECUTE IMMEDIATE AdbInterimInsertStr;
PROCEDURE update_adb_func_ent_bal(x_src_table VARCHAR2,
x_start_id NUMBER DEFAULT NULL,
x_end_id NUMBER DEFAULT NULL) IS
fn_name CONSTANT VARCHAR2(30) := 'UPDATE_ADB_FUNC_ENT_BAL';
AdbUpdateFuncEntBalStr VARCHAR2(2600);
AdbUpdateFuncEntBalStr :=
'UPDATE ' || x_src_table || ' b1 ' ||
'SET (b1.opening_period_aggregate,'||
' b1.opening_quarter_aggregate,' ||
' b1.opening_year_aggregate,' ||
' b1.period_aggregate1, b1.period_aggregate2,' ||
' b1.period_aggregate3, b1.period_aggregate4,' ||
' b1.period_aggregate5, b1.period_aggregate6,' ||
' b1.period_aggregate7, b1.period_aggregate8,' ||
' b1.period_aggregate9, b1.period_aggregate10,' ||
' b1.period_aggregate11, b1.period_aggregate12,' ||
' b1.period_aggregate13, b1.period_aggregate14,' ||
' b1.period_aggregate15, b1.period_aggregate16,' ||
' b1.period_aggregate17, b1.period_aggregate18,' ||
' b1.period_aggregate19, b1.period_aggregate20,' ||
' b1.period_aggregate21, b1.period_aggregate22,' ||
' b1.period_aggregate23, b1.period_aggregate24,' ||
' b1.period_aggregate25, b1.period_aggregate26,' ||
' b1.period_aggregate27, b1.period_aggregate28,' ||
' b1.period_aggregate29, b1.period_aggregate30,' ||
' b1.period_aggregate31, b1.period_aggregate32,' ||
' b1.period_aggregate33, b1.period_aggregate34,' ||
' b1.period_aggregate35) ' ||
' = (SELECT '||
' di.opening_period_aggregate,' ||
' di.opening_quarter_aggregate,' ||
' di.opening_year_aggregate,' ||
' di.period_aggregate1, di.period_aggregate2,' ||
' di.period_aggregate3, di.period_aggregate4,' ||
' di.period_aggregate5, di.period_aggregate6,' ||
' di.period_aggregate7, di.period_aggregate8,' ||
' di.period_aggregate9, di.period_aggregate10,' ||
' di.period_aggregate11, di.period_aggregate12,' ||
' di.period_aggregate13, di.period_aggregate14,' ||
' di.period_aggregate15, di.period_aggregate16,' ||
' di.period_aggregate17, di.period_aggregate18,' ||
' di.period_aggregate19, di.period_aggregate20,' ||
' di.period_aggregate21, di.period_aggregate22,' ||
' di.period_aggregate23, di.period_aggregate24,' ||
' di.period_aggregate25, di.period_aggregate26,' ||
' di.period_aggregate27, di.period_aggregate28,' ||
' di.period_aggregate29, di.period_aggregate30,' ||
' di.period_aggregate31, di.period_aggregate32,' ||
' di.period_aggregate33, di.period_aggregate34,' ||
' di.period_aggregate35' ||
' FROM gl_efb_upgrade_adb di' ||
' WHERE di.ledger_id = b1.ledger_id' ||
' AND di.code_combination_id = b1.code_combination_id' ||
' AND di.currency_code = b1.currency_code' ||
' AND di.period_name = b1.period_name) ' ||
'WHERE b1.currency_code = ' ||
' (select currency_code' ||
' from gl_ledgers' ||
' where ledger_id = b1.ledger_id) ' ||
'AND b1.actual_flag = ''A'' ' ||
'AND b1.currency_type = ''E'' ' ||
'AND b1.converted_from_currency IS NULL ' ||
ccid_range;
EXECUTE IMMEDIATE AdbUpdateFuncEntBalStr USING x_start_id, x_end_id;
EXECUTE IMMEDIATE AdbUpdateFuncEntBalStr;
END update_adb_func_ent_bal;
PROCEDURE insert_adb_func_ent_bal(x_src_table VARCHAR2) IS
fn_name CONSTANT VARCHAR2(30) := 'INSERT_ADB_FUNC_ENT_BAL';
AdbInsertFuncEntBalStr VARCHAR2(2800);
l_who_cols := ' creation_date, created_by, last_update_date,' ||
' last_updated_by, last_update_login,';
AdbInsertFuncEntBalStr :=
'INSERT INTO ' || x_src_table || ' ' ||
'(ledger_id, code_combination_id, currency_code,' ||
' currency_type, actual_flag, period_name,' ||
' period_start_date, period_end_date,' ||
' quarter_start_date, year_start_date,' ||
l_who_cols ||
' converted_from_currency, period_type, period_year,' ||
' period_num, template_id,' ||
' opening_period_aggregate,' ||
' opening_quarter_aggregate,' ||
' opening_year_aggregate,' ||
' period_aggregate1, period_aggregate2, period_aggregate3,'||
' period_aggregate4, period_aggregate5, period_aggregate6,' ||
' period_aggregate7, period_aggregate8, period_aggregate9,' ||
' period_aggregate10, period_aggregate11, period_aggregate12,' ||
' period_aggregate13, period_aggregate14, period_aggregate15,' ||
' period_aggregate16, period_aggregate17, period_aggregate18,' ||
' period_aggregate19, period_aggregate20, period_aggregate21,' ||
' period_aggregate22, period_aggregate23, period_aggregate24,' ||
' period_aggregate25, period_aggregate26, period_aggregate27,' ||
' period_aggregate28, period_aggregate29, period_aggregate30,' ||
' period_aggregate31, period_aggregate32, period_aggregate33,' ||
' period_aggregate34, period_aggregate35) ' ||
'SELECT ' ||
' di.ledger_id, di.code_combination_id, di.currency_code,' ||
' ''E'', ''A'', di.period_name,' ||
' di.period_start_date, di.period_end_date,' ||
' di.quarter_start_date, di.year_start_date,' ||
l_who_vals ||
' NULL, di.period_type, di.period_year,' ||
' di.period_num, di.template_id,' ||
' di.opening_period_aggregate,' ||
' di.opening_quarter_aggregate,' ||
' di.opening_year_aggregate,' ||
' di.period_aggregate1, di.period_aggregate2, di.period_aggregate3,' ||
' di.period_aggregate4, di.period_aggregate5, di.period_aggregate6,' ||
' di.period_aggregate7, di.period_aggregate8, di.period_aggregate9,' ||
' di.period_aggregate10, di.period_aggregate11, di.period_aggregate12,'||
' di.period_aggregate13, di.period_aggregate14, di.period_aggregate15,'||
' di.period_aggregate16, di.period_aggregate17, di.period_aggregate18,'||
' di.period_aggregate19, di.period_aggregate20, di.period_aggregate21,'||
' di.period_aggregate22, di.period_aggregate23, di.period_aggregate24,'||
' di.period_aggregate25, di.period_aggregate26, di.period_aggregate27,'||
' di.period_aggregate28, di.period_aggregate29, di.period_aggregate30,'||
' di.period_aggregate31, di.period_aggregate32, di.period_aggregate33,'||
' di.period_aggregate34, di.period_aggregate35 ' ||
'FROM gl_efb_upgrade_adb di ' ||
'WHERE not exists' ||
' (select 1' ||
' from ' || x_src_table || ' b2' ||
' where b2.ledger_id = di.ledger_id' ||
' and b2.code_combination_id = di.code_combination_id' ||
' and b2.currency_code = di.currency_code' ||
' and b2.currency_type = ''E''' ||
' and b2.actual_flag = ''A''' ||
' and b2.period_name = di.period_name' ||
' and b2.converted_from_currency is null)';
EXECUTE IMMEDIATE AdbInsertFuncEntBalStr;
END insert_adb_func_ent_bal;
SELECT nvl(max(1), 0)
INTO l_table_exists
FROM DBA_TABLES
WHERE table_name = x_table_name
AND owner = x_gl_schema;
SELECT nvl(max(1), 0)
INTO l_column_exists
FROM ALL_TAB_COLUMNS
WHERE table_name = x_table_name
AND owner = x_gl_schema
AND column_name = 'SET_OF_BOOKS_ID';
SELECT efb_upgrade_flag
INTO l_efb_upgrade_flag
FROM GL_SYSTEM_USAGES
WHERE rownum = 1;
AD_PARALLEL_UPDATES_PKG.delete_update_information(
ad_parallel_updates_pkg.ID_RANGE,
l_gl_schema,
g_table_name,
g_script_name);
UPDATE GL_SYSTEM_USAGES
SET efb_upgrade_flag = 'Y',
last_update_date = sysdate,
last_updated_by = 1,
last_update_login = 0;
ad_parallel_updates_pkg.initialize_id_range(
ad_parallel_updates_pkg.ID_RANGE,
x_argument4,
g_table_name,
g_script_name,
g_id_column,
x_worker_id,
x_num_workers,
x_batch_size, 0);
ad_parallel_updates_pkg.get_id_range(
l_start_id,
l_end_id,
l_any_rows_to_process,
x_batch_size,
TRUE);
update_std_foreign_ent_bal(g_std_bal_table, l_start_id, l_end_id);
update_std_func_ent_bal(g_std_bal_table, l_start_id, l_end_id);
update_adb_func_ent_bal(g_adb_bal_table, l_start_id, l_end_id);
insert_adb_func_ent_bal(g_adb_bal_table);
SELECT count(*)
INTO l_rows_processed
FROM gl_code_combinations
WHERE code_combination_id between l_start_id and l_end_id;
ad_parallel_updates_pkg.processed_id_range(
l_rows_processed,
l_end_id);
ad_parallel_updates_pkg.get_id_range(
l_start_id,
l_end_id,
l_any_rows_to_process,
x_batch_size,
FALSE);
SELECT ledger_id
FROM GL_LEDGERS
WHERE object_type_code = 'L';
SELECT movemerge_request_id mm_req_id
FROM gl_movemerge_requests
WHERE ledger_id = v_ledger_id
AND status_code = 'MC';
SELECT NVL(MAX(last_purged_eff_period_num), 0)
INTO l_last_purged_eff_period_num
FROM GL_ARCHIVE_HISTORY
WHERE ledger_id = rec.ledger_id
AND actual_flag = 'A'
AND data_type = 'A';
sql_stmt := 'DELETE FROM ' || l_table_name ||
' WHERE (PERIOD_YEAR * 10000 + PERIOD_NUM) <= :p_num' ||
' AND ACTUAL_FLAG = ''A'' ';
update_std_foreign_ent_bal(l_table_name);
update_std_func_ent_bal(l_table_name);
sql_stmt := 'DELETE FROM ' || l_table_name ||
' WHERE (PERIOD_YEAR * 10000 + PERIOD_NUM) <= :p_num' ||
' AND ACTUAL_FLAG = ''A'' ';
update_adb_func_ent_bal(l_table_name);
insert_adb_func_ent_bal(l_table_name);