mmt sql
This commit is contained in:
55
onetime/wrappers/wrapper_PTOBEN_v1.sql
Executable file
55
onetime/wrappers/wrapper_PTOBEN_v1.sql
Executable file
@@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
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
|
||||
/****************************************************************
|
||||
******* ForeWarn Licensing and / or usage Terms and Conditions ******
|
||||
ForeWarn. The NextGen Insights Solution Platform
|
||||
|
||||
Copyright 2021 COMPEGENCE. All Rights Reserved
|
||||
|
||||
ForeWarn is a product of COMPEGENCE.
|
||||
To be used only with a valid license from COMPEGENCE
|
||||
|
||||
www.compegence.com info@compegence.com
|
||||
****************************************************************/
|
||||
|
||||
|
||||
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;
|
||||
Reference in New Issue
Block a user