--Unload Parameter und deren Defaults setzen --freemarker template select sp_table_exists('unload_params') from xdummy; <#if unload_params_exists=1> create temp table tmp_unload_params( tid SERIAL not null, param_id VARCHAR(255) not null, param_val VARCHAR(255) , default_val VARCHAR(255) , description VARCHAR(255) , systeminfo_id INTEGER ); insert into tmp_unload_params(param_id, param_val, default_val, description, systeminfo_id) values ('EXTERNAL_SUBJECTS', 'false', 'false', 'Übergabe externe Fächer von COSTAGE ans Studierenden-Modul', 7); --description wird immer geändert: update unload_params set description=(select T.description from tmp_unload_params T where T.param_id=unload_params.param_id and T.systeminfo_id=unload_params.systeminfo_id) where systeminfo_id=7 and param_id in (select param_id from tmp_unload_params); --default_val wird immer geändert: update unload_params set default_val=(select T.default_val from tmp_unload_params T where T.param_id=unload_params.param_id and T.systeminfo_id=unload_params.systeminfo_id) where systeminfo_id=7 and param_id in (select param_id from tmp_unload_params); delete from tmp_unload_params where systeminfo_id || param_id in (select systeminfo_id || param_id from unload_params); insert into unload_params(param_id, param_val, default_val, description, systeminfo_id) select param_id, param_val, default_val, description, systeminfo_id from tmp_unload_params where param_id is not null; drop table tmp_unload_params;