You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
1.7 KiB
92 lines
1.7 KiB
--freemarker template |
|
|
|
<#if SQLdialect='Postgres'> |
|
select sp_update_sequence('sx_repository'); |
|
select sp_update_sequence('tmp_repository'); |
|
</#if> |
|
|
|
delete from tmp_repository where id in (select id from sx_repository); |
|
|
|
insert into sx_repository |
|
( |
|
id, |
|
content, |
|
caption, |
|
comment, |
|
version, |
|
art, |
|
art2, |
|
art3, |
|
sachgebiete_id, |
|
sort1, |
|
sort2, |
|
sort3, |
|
geaendert_am, |
|
aktiv, |
|
gueltig_seit, |
|
gueltig_bis |
|
) |
|
|
|
SELECT |
|
id, |
|
content, |
|
caption, |
|
comment, |
|
version, |
|
art, |
|
art2, |
|
art3, |
|
sachgebiete_id, |
|
sort1, |
|
sort2, |
|
sort3, |
|
geaendert_am, |
|
aktiv, |
|
gueltig_seit, |
|
gueltig_bis |
|
FROM tmp_repository; |
|
|
|
<#if SQLdialect='Postgres'> |
|
select sp_update_sequence('sx_repository'); |
|
</#if> |
|
|
|
drop table tmp_repository; |
|
|
|
INSERT INTO sx_repository |
|
(id, content, caption, comment, art, sachgebiete_id, sort1, sort2, sort3, aktiv) |
|
SELECT |
|
'KoF_RPTA_' || tid::char(255), |
|
content, |
|
caption, |
|
comment, |
|
'SOS_KOEPFE_FAELLE_RPTA', |
|
16, 1, 0, 0, 1 |
|
FROM sx_repository k |
|
WHERE id like 'KoF_%' |
|
and art = 'SOS_KOEPFE_FAELLE' |
|
and content not ilike '%gew%' |
|
and NOT EXISTS ( |
|
SELECT 1 |
|
FROM sx_repository s |
|
WHERE s.id = 'KoF_RPTA_' || k.tid::char(255) |
|
); |
|
|
|
|
|
INSERT INTO sx_repository |
|
(id, content, caption, comment, art, sachgebiete_id, sort1, sort2, sort3, aktiv) |
|
SELECT |
|
'KoF_RPTA_' || tid::char(255), |
|
content, |
|
caption, |
|
comment, |
|
'SOS_KOEPFE_FAELLE_RPTA_GEW', |
|
16, 1, 0, 0, 1 |
|
FROM sx_repository k |
|
WHERE id like 'KoF_%' |
|
and art = 'SOS_KOEPFE_FAELLE' |
|
and content ilike '%gew%' |
|
and NOT EXISTS ( |
|
SELECT 1 |
|
FROM sx_repository s |
|
WHERE s.id = 'KoF_RPTA_' || k.tid::char(255) |
|
); |