Files
MMT/deployment-20210427T103328Z-001/deployment/wrappers/DBSTD_wrapper.txt
2021-04-27 16:13:33 +05:30

23 lines
786 B
Plaintext

drop function if exists mmt_staging2.fn_DBSTD_RUN;
CREATE OR REPLACE FUNCTION mmt_staging2.fn_DBSTD_RUN()
RETURNS void AS $$
declare
f record;
w_file_syspk int;
status text;
begin
for f in select distinct a.file_syspk
from mmt_staging1.mmt_staging_generic_table a
where file_format = 'DBSTD' order by file_syspk
loop
select f.file_syspk into w_file_syspk;
perform mmt_staging2.fn_dbstd_test_block(1,2,'DBSTD','DBSTD_TEST',w_file_syspk);
select e.status from mmt_staging2.mmt_DB_Run_Status e where file_syspk = w_file_syspk and sheet_mnemonic ='DBSTD_TEST' into status;
if status = 'success' then
perform mmt_ods.fn_dbstd_test_ods(w_file_syspk);
end if;
end loop;
end;
$$ LANGUAGE plpgsql;
--select mmt_staging2.fn_DBSTD_RUN()