--Freemarker Template create temp table tmp_hilf (tid integer); --Sicherstellen, dass keine Duplikate vorkommen: --#################################################################################################### delete from sx_mask_style where maskeninfo_id=21000 and stylesheet_id in (select tid from sx_stylesheets where filename ='tabelle_html.xsl') and ord=1; delete from sx_mask_style where maskeninfo_id=21000 and stylesheet_id in (select tid from sx_stylesheets where filename ='tabelle_html_viz.xsl') and ord=10; -- Mask Style füllen --#################################################################################################### create temp table tmp_mask_style ( tid serial not null, maskeninfo_id INTEGER , stylesheet_id INTEGER , ord SMALLINT, filename char(255) ); delete from tmp_hilf; insert into tmp_hilf select max(tid) from sx_mask_style; update tmp_hilf set tid=1 where tid is null; insert into tmp_mask_style (tid,maskeninfo_id,ord,filename) select max(tid)+1,47030,10,'tabelle_html_viz.xsl' from tmp_hilf where 0< (select count(*) from sx_stylesheets where filename='tabelle_html_viz.xsl'); update tmp_mask_style set stylesheet_id=(select max(tid) from sx_stylesheets where filename='tabelle_html_viz.xsl') where filename='tabelle_html_viz.xsl'; insert into sx_mask_style ( tid, maskeninfo_id, stylesheet_id, ord) SELECT tid, maskeninfo_id, stylesheet_id, ord FROM tmp_mask_style; drop table tmp_mask_style; drop table tmp_hilf; select sp_update_sequence('sx_stylesheets'); select sp_update_sequence('sx_mask_style'); select sp_update_sequence('stylesheet_field');