latest_mmt_version
This commit is contained in:
BIN
MMT_latest_version/sql/onetime/wrappers/.wrapper_FTDRY.sql.swp
Normal file
BIN
MMT_latest_version/sql/onetime/wrappers/.wrapper_FTDRY.sql.swp
Normal file
Binary file not shown.
211
MMT_latest_version/sql/onetime/wrappers/master_wrapper.sql
Normal file
211
MMT_latest_version/sql/onetime/wrappers/master_wrapper.sql
Normal file
@@ -0,0 +1,211 @@
|
||||
drop function if exists staging2.fn_run_master_wrapper;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_run_master_wrapper()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
stg2_status text;
|
||||
error_sum int;
|
||||
err_file_syspk int;
|
||||
TRX_status text;
|
||||
begin
|
||||
|
||||
|
||||
update fw_core.fw_jobctl_runschedule_jobstep set begin_status='Started',start_time=now() where job_id = 2 and step_id = 1 and latest_runschedule_flag = '1';
|
||||
|
||||
for f in select distinct file_syspk,file_mnemonic,file_sheet_mnemonic,client_id,function_id
|
||||
from fw_core.fw_jobctl_file_sheet_runschedule where file_sheet_mnemonic !=''
|
||||
and latest_runschedule_flag = '1' and end_status != 'error' and end_status_note = 'stg1_completed'--and file_mnemonic not in ('DBOECD','IHTSLL','IHT')
|
||||
order by file_syspk
|
||||
loop
|
||||
|
||||
if err_file_syspk = f.file_syspk then
|
||||
--incase of file stg2/trx fail then dont run script for those files and rollback previous change if any.
|
||||
--rollback for that file syspk needs to be added
|
||||
--perform staging2.run_trx_rollback(f.file_syspk)
|
||||
continue;
|
||||
else
|
||||
--run staging 2 scripts depending on sheet mnemonic
|
||||
if f.file_sheet_mnemonic = 'FTDRY_TRS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_TRS_Block('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTDRY_SUM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_SUM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTWET_TRS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_ftwet_trs_block('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTWET_SUM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTWET_SUM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTHLG_TRS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_TRS_Block('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTHLG_SUM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_SUM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'DBSTD_TEST' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dbstd_test_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'DBOECD_TEST' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dboecd_test_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic in ('PTOBEN_PRFN','PTOBEN_PRFE','PTOBEN_PRFB','PTOSTD_PRF') then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic in ('PTOBEN_MPM','PTOSTD_MPM') then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic in ('PTOBEN_GVG','PTOSTD_GVG') then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_BRK' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_BRK_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_FLD' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_FLD_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_HDL' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HDL_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_NMT' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_NMT_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_HLG' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HLG_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_PTO' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_PTO_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_VMT' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_VMT_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_ARC' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_ARC_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_DBP' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_DBP_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_LCG' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_LCG_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTCGM_CGM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTCGM_CGM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTEMT_STD' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_STD_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTEMT_EMT' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_EMT_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTHAM_HAM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHAM_HAM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTHLS_HLS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHLS_HLS_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTNST_NST' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTNST_NST_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTSLL_SLL' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTSLL_SLL_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTBT30_BT30' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT30_BT30_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTBT50_BT50' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT50_BT50_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTBTD_BTD' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBTD_BTD_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
else perform fw_core.fn_insert_db_error ( f.function_id, f.function_id, 1001, 'Compegence', f.file_syspk ,f.file_mnemonic,f.file_sheet_mnemonic ,null,'stg2 wrapper', 'unknown block', null, 'no script found', 'Script not present for the particlar sheet mnemonic', null, null,'error');
|
||||
end if;
|
||||
-- check if staging 2 script ran correctly and update fw_jobctl_file_sheet_runschedule table.
|
||||
select e.status from fw_core.db_run_status e where file_syspk = f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic and staging_type = 'stg2' order by error_timestamp desc into stg2_status;
|
||||
if stg2_status = 'success' then
|
||||
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg2_completed', end_status='success',staging_type = 'stg2',end_time = (select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'stg2' order by e.error_timestamp desc limit 1)
|
||||
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
|
||||
else
|
||||
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg2_failed', end_status='error',staging_type = 'stg2',end_time = (select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'stg2' order by e.error_timestamp desc limit 1)
|
||||
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
|
||||
--if error occured store in err_file_syspk variable and go to next file in loop
|
||||
err_file_syspk := f.file_syspk;
|
||||
continue;
|
||||
end if;
|
||||
|
||||
|
||||
--run transactional scripts depending on sheet mnemonic
|
||||
if f.file_sheet_mnemonic = 'FTDRY_TRS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_TRS_TRX('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTDRY_SUM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_SUM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTWET_TRS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_ftwet_trs_TRX('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTWET_SUM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTWET_SUM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTHLG_TRS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_TRS_TRX('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'FTHLG_SUM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_SUM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'DBSTD_TEST' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dbstd_test_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'DBOECD_TEST' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dboecd_test_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic in ('PTOBEN_PRFN','PTOBEN_PRFE','PTOBEN_PRFB','PTOSTD_PRF') then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic in ('PTOBEN_MPM','PTOSTD_MPM') then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic in ('PTOBEN_GVG','PTOSTD_GVG') then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_BRK' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_BRK_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_FLD' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_FLD_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_HDL' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HDL_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_NMT' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_NMT_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_HLG' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HLG_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_PTO' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_PTO_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_VMT' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_VMT_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_ARC' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_ARC_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_DBP' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_DBP_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'BUDNI_LCG' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_LCG_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTCGM_CGM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTCGM_CGM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTEMT_STD' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_STD_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTEMT_EMT' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_EMT_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTHAM_HAM' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHAM_HAM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTHLS_HLS' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHLS_HLS_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTNST_NST' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTNST_NST_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTSLL_SLL' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTSLL_SLL_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTBT30_BT30' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT30_BT30_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTBT50_BT50' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT50_BT50_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
elsif f.file_sheet_mnemonic = 'IHTBTD_BTD' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBTD_BTD_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
|
||||
else perform fw_core.fn_insert_db_error ( f.function_id, f.function_id, 1001, 'Compegence', f.file_syspk ,f.file_mnemonic, f.file_sheet_mnemonic ,null,'TRX wrapper', 'unknown TRX', null, 'no script found', null, null, null,'error');
|
||||
end if;
|
||||
-- check if transactional script ran correctly and update fw_jobctl_file_sheet_runschedule table.
|
||||
select e.status from fw_core.db_run_status e where file_syspk = f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic and staging_type = 'trx' order by error_timestamp desc into TRX_status;
|
||||
if TRX_status = 'success' then
|
||||
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'TRX_completed', end_status='success',staging_type = 'trx',end_time = now()
|
||||
--(select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'trx' order by e.error_timestamp desc limit 1)
|
||||
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
|
||||
else
|
||||
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'TRX_failed', end_status='error',staging_type = 'trx',end_time = now()
|
||||
--(select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'trx' order by e.error_timestamp desc limit 1)
|
||||
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
|
||||
--if error occured store in err_file_syspk variable and go to next file in loop
|
||||
err_file_syspk := f.file_syspk;
|
||||
continue;
|
||||
end if;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
-- update fw_jobctl_file_runschedule table.
|
||||
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'stg2_failed', end_status='error',staging_type = 'stg2',end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a
|
||||
where a.latest_runschedule_flag = '1' and a.end_status = 'error' and a.end_status_note = 'stg2_failed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
|
||||
|
||||
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'TRX_failed', end_status='error',staging_type = 'trx' ,end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a
|
||||
where a.latest_runschedule_flag = '1' and a.end_status = 'error' and a.end_status_note = 'TRX_failed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
|
||||
|
||||
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'TRX_completed', end_status='success',staging_type = 'trx',end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a
|
||||
where a.latest_runschedule_flag = '1' and a.end_status = 'success' and a.end_status_note ='TRX_completed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
|
||||
|
||||
-- update fw_jobctl_runschedule_jobstep table.
|
||||
SELECT SUM (case WHEN end_status = 'success' THEN 0
|
||||
ELSE 1 END) AS "Error Sum" FROM fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag = '1' INTO error_sum;
|
||||
if error_sum = 0 then
|
||||
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'TRX_completed', end_status='success', end_time=now() where job_id = 2 and step_id = 1 and latest_runschedule_flag = '1';
|
||||
else
|
||||
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'TRX_failed', end_status='error', end_time=now() where job_id = 2 and step_id = 1 and latest_runschedule_flag = '1';
|
||||
end if;
|
||||
|
||||
|
||||
perform (select staging2.run_trx_rollback());
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
66
MMT_latest_version/sql/onetime/wrappers/wrapper_BUDNI.sql
Normal file
66
MMT_latest_version/sql/onetime/wrappers/wrapper_BUDNI.sql
Normal file
@@ -0,0 +1,66 @@
|
||||
drop function if exists staging2.fn_BUDNI_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_BUDNI_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select distinct a.file_syspk
|
||||
from fw_core.fw_jobctl_file_runschedule a
|
||||
where end_status like 'stg1-completed' and file_mnemonic='BUDNI'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_ARC_Block(20,1,''BUDNI'',''BUDNI_ARC'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_ARC' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_ARC_TRX(20,1,''BUDNI'',''BUDNI_ARC'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_BRK_Block (20,1,''BUDNI'',''BUDNI_BRK'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_BRK' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_BRK_TRX(20,1,''BUDNI'',''BUDNI_BRK'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_DBP_Block (20,1,''BUDNI'',''BUDNI_DBP'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_DBP' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_DBP_TRX(20,1,''BUDNI'',''BUDNI_DBP'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_FLD_Block (20,1,''BUDNI'',''BUDNI_FLD'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_FLD' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_FLD_TRX(20,1,''BUDNI'',''BUDNI_FLD'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HDL_Block(20,1,''BUDNI'',''BUDNI_HDL'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_HDL' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HDL_TRX(20,1,''BUDNI'',''BUDNI_HDL'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HLG_Block(20,1,''BUDNI'',''BUDNI_HLG'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_HLG' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HLG_TRX(20,1,''BUDNI'',''BUDNI_HLG'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_LCG_Block(20,1,''BUDNI'',''BUDNI_LCG'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_LCG' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_LCG_TRX(20,1,''BUDNI'',''BUDNI_LCG'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_NMT_Block(20,1,''BUDNI'',''BUDNI_NMT'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_NMT' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_NMT_TRX(20,1,''BUDNI'',''BUDNI_NMT'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_PTO_Block(20,1,''BUDNI'',''BUDNI_PTO'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_PTO' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_PTO_TRX(20,1,''BUDNI'',''BUDNI_PTO'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_VMT_Block(20,1,''BUDNI'',''BUDNI_VMT'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='BUDNI_VMT' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_VMT_TRX(20,1,''BUDNI'',''BUDNI_VMT'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
20
MMT_latest_version/sql/onetime/wrappers/wrapper_DBOECD.sql
Normal file
20
MMT_latest_version/sql/onetime/wrappers/wrapper_DBOECD.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
drop function if exists staging2.fn_DBOECD_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_DBOECD_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic='DBOECD'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dboecd_test_block(20,1,''DBOECD'',''DBOECD_TEST'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='DBOECD_TEST' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dboecd_test_trx(20,1,''DBOECD'',''DBOECD_TEST'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
20
MMT_latest_version/sql/onetime/wrappers/wrapper_DBSTD.sql
Normal file
20
MMT_latest_version/sql/onetime/wrappers/wrapper_DBSTD.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
drop function if exists staging2.fn_DBSTD_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_DBSTD_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic='DBSTD'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dbstd_test_block(20,1,''DBSTD'',''DBSTD_TEST'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='DBSTD_TEST' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_dbstd_test_trx(20,1,''DBSTD'',''DBSTD_TEST'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
25
MMT_latest_version/sql/onetime/wrappers/wrapper_FTDRY.sql
Normal file
25
MMT_latest_version/sql/onetime/wrappers/wrapper_FTDRY.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
drop function if exists staging2.fn_FTDRY_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_FTDRY_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic='FTDRY'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_TRS_Block(20,1,''FTDRY'',''FTDRY_TRS'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='FTDRY_TRS' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_TRS_TRX(20,1,''FTDRY'',''FTDRY_TRS'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_SUM_Block (20,1,''FTDRY'',''FTDRY_SUM'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='FTDRY_SUM' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_SUM_TRX(20,1,''FTDRY'',''FTDRY_SUM'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
25
MMT_latest_version/sql/onetime/wrappers/wrapper_FTHLG.sql
Normal file
25
MMT_latest_version/sql/onetime/wrappers/wrapper_FTHLG.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
drop function if exists staging2.fn_FTHLG_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_FTHLG_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic='FTHLG'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_TRS_Block(20,1,''FTHLG'',''FTHLG_TRS'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='FTHLG_TRS' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_TRS_TRX(20,1,''FTHLG'',''FTHLG_TRS'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_SUM_Block (20,1,''FTHLG'',''FTHLG_SUM'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='FTHLG_SUM' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_SUM_TRX(20,1,''FTHLG'',''FTHLG_SUM'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
25
MMT_latest_version/sql/onetime/wrappers/wrapper_FTWET.sql
Normal file
25
MMT_latest_version/sql/onetime/wrappers/wrapper_FTWET.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
drop function if exists staging2.fn_FTWET_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_FTWET_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic='FTWET'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_ftwet_trs_block(20,1,''FTWET'',''FTWET_TRS'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='FTWET_TRS' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTWET_TRS_TRX(20,1,''FTWET'',''FTWET_TRS'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_ftwet_sum_block (20,1,''FTWET'',''FTWET_SUM'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='FTWET_SUM' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_FTWET_SUM_TRX(20,1,''FTWET'',''FTWET_SUM'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTBT30.sql
Normal file
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTBT30.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
drop function if exists staging2.fn_IHTBT30_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTBT30_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTBT30' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT30_BT30_Block(20,1,''IHTBT30'',''IHTBT30_BT30'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTBT30_BT30' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT30_BT30_TRX(20,1,''IHTBT30'',''IHTBT30_BT30'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTBT50.sql
Normal file
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTBT50.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
drop function if exists staging2.fn_IHTBT50_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTBT50_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTBT50' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT50_BT50_Block(20,1,''IHTBT50'',''IHTBT50_BT50'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTBT50_BT50' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT50_BT50_TRX(20,1,''IHTBT50'',''IHTBT50_BT50'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
22
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTBTD.sql
Normal file
22
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTBTD.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
drop function if exists staging2.fn_IHTBTD_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTBTD_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTBTD' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBTD_BTD_Block(20,1,''IHTBTD'',''IHTBTD_BTD'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTBTD_BTD'
|
||||
order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTBTD_BTD_TRX(20,1,''IHTBTD'',''IHTBTD_BTD'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
22
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTCGM.sql
Normal file
22
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTCGM.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
drop function if exists staging2.fn_IHTCGM_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTCGM_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTCGM' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTCGM_CGM_Block(20,1,''IHTCGM'',''IHTCGM_CGM'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTCGM_CGM'
|
||||
order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTCGM_CGM_TRX(20,1,''IHTCGM'',''IHTCGM_CGM'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
26
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTEMT.sql
Normal file
26
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTEMT.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
drop function if exists staging2.fn_IHTEMT_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTEMT_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTEMT' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_EMT_Block(20,1,''IHTEMT'',''IHTEMT_EMT'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTEMT_EMT' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_EMT_TRX(20,1,''IHTEMT'',''IHTEMT_EMT'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_STD_Block(20,1,''IHTEMT'',''IHTEMT_STD'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTEMT_STD' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_STD_TRX(20,1,''IHTEMT'',''IHTEMT_STD'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
22
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTHAM.sql
Normal file
22
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTHAM.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
drop function if exists staging2.fn_IHTHAM_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTHAM_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTHAM' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHAM_HAM_Block(20,1,''IHTHAM'',''IHTHAM_HAM'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTHAM_HAM'
|
||||
order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHAM_HAM_TRX(20,1,''IHTHAM'',''IHTHAM_HAM'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTHSL.sql
Normal file
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTHSL.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
drop function if exists staging2.fn_IHTHSL_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTHSL_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTHSL' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHSL_HSL_Block(20,1,''IHTHSL'',''IHTHSL_HSL'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTHSL_HSL' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTHSL_HSL_TRX(20,1,''IHTHSL'',''IHTHSL_HSL'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTNST.sql
Normal file
21
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTNST.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
drop function if exists staging2.fn_IHTNST_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTNST_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTNST' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTNST_NST_Block(20,1,''IHTNST'',''IHTNST_NST'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTNST_NST' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTNST_NST_TRX(20,1,''IHTNST'',''IHTNST_NST'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
20
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTSLL.sql
Normal file
20
MMT_latest_version/sql/onetime/wrappers/wrapper_IHTSLL.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
drop function if exists staging2.fn_IHTSLL_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_IHTSLL_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic = 'IHTSLL' order by file_syspk
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTSLL_SLL_Block(20,1,''IHTSLL'',''IHTSLL_SLL'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='IHTSLL_SLL' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_IHTSLL_SLL_TRX(20,1,''IHTSLL'',''IHTSLL_SLL'','||w_file_syspk||')'); end if;
|
||||
end loop;
|
||||
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
40
MMT_latest_version/sql/onetime/wrappers/wrapper_PTOBEN.sql
Normal file
40
MMT_latest_version/sql/onetime/wrappers/wrapper_PTOBEN.sql
Normal file
@@ -0,0 +1,40 @@
|
||||
drop function if exists staging2.fn_PTOBEN_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_PTOBEN_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic='PTOBEN'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_block(20,1,''PTOBEN'',''PTOBEN_PRFN'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOBEN_PRFN' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_TRX(20,1,''PTOBEN'',''PTOBEN_PRFN'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_block(20,1,''PTOBEN'',''PTOBEN_PRFB'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOBEN_PRFB' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_TRX(20,1,''PTOBEN'',''PTOBEN_PRFB'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_block(20,1,''PTOBEN'',''PTOBEN_PRFE'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOBEN_PRFE' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_TRX(20,1,''PTOBEN'',''PTOBEN_PRFE'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_block(20,1,''PTOBEN'',''PTOBEN_MPM'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOBEN_MPM' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_TRX(20,1,''PTOBEN'',''PTOBEN_MPM'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_block(20,1,''PTOBEN'',''PTOBEN_GVG'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOBEN_GVG' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_TRX(20,1,''PTOBEN'',''PTOBEN_GVG'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
30
MMT_latest_version/sql/onetime/wrappers/wrapper_PTOSTD.sql
Normal file
30
MMT_latest_version/sql/onetime/wrappers/wrapper_PTOSTD.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
drop function if exists staging2.fn_PTOSTD_RUN;
|
||||
CREATE OR REPLACE FUNCTION staging2.fn_PTOSTD_RUN()
|
||||
RETURNS void AS $$
|
||||
declare
|
||||
f record;
|
||||
w_file_syspk int;
|
||||
status text;
|
||||
begin
|
||||
for f in select file_syspk from fw_core.fw_jobctl_file_runschedule
|
||||
where end_status like 'stg1-completed' and file_mnemonic='PTOSTD'
|
||||
loop
|
||||
select f.file_syspk into w_file_syspk;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_block(20,1,''PTOSTD'',''PTOSTD_PRF'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOSTD_PRF' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_TRX(20,1,''PTOSTD'',''PTOSTD_PRF'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_block(20,1,''PTOSTD'',''PTOSTD_MPM'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOSTD_MPM' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_TRX(20,1,''PTOSTD'',''PTOSTD_MPM'','||w_file_syspk||')');
|
||||
end if;
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_block(20,1,''PTOSTD'',''PTOSTD_GVG'','||w_file_syspk||')');
|
||||
select e.status from fw_core.db_run_status e where file_syspk = w_file_syspk and file_sheet_mnemonic ='PTOSTD_GVG' order by error_timestamp desc into status;
|
||||
if status = 'success' then
|
||||
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_TRX(20,1,''PTOSTD'',''PTOSTD_GVG'','||w_file_syspk||')');
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;
|
||||
Reference in New Issue
Block a user