sql files

This commit is contained in:
dheepa
2021-07-02 08:40:37 +00:00
commit a0d3257be0
154 changed files with 49773 additions and 0 deletions

View 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;