53 lines
2.5 KiB
SQL
53 lines
2.5 KiB
SQL
-- Customer specific once-script LOGI#27979.
|
|
--
|
|
-- (c) 2014 SG|facilitor bv
|
|
--
|
|
-- Support: +31 53 4800700
|
|
SET ECHO ON
|
|
SPOOL xLOGI27979.lst
|
|
SET DEFINE OFF
|
|
|
|
-- Zorg dat voorlopig niet gebruikte WP-ruimtenummers onderin de lijst komen!
|
|
-- Vooraf gecontroleerd dat WP-ruimtenummers nooit >9!
|
|
UPDATE alg_ruimte
|
|
SET alg_ruimte_nr = 'x' || alg_ruimte_nr
|
|
WHERE alg_ruimte_verwijder IS NULL AND LENGTH (alg_ruimte_nr) <= 9
|
|
AND alg_ruimte_key IN
|
|
(SELECT DISTINCT r.alg_ruimte_key
|
|
FROM res_ruimte rr, res_alg_ruimte rar, alg_ruimte r
|
|
WHERE rr.res_ruimte_verwijder IS NULL
|
|
AND ( RR.RES_DISCIPLINE_KEY = 1281 -- Secured WP-2 ROT 1A
|
|
OR RR.RES_DISCIPLINE_KEY BETWEEN 1201 AND 1225 -- ROT
|
|
OR RR.RES_DISCIPLINE_KEY = 624 -- Flex place type WP-1
|
|
OR RR.RES_DISCIPLINE_KEY = 621) -- Silent place type WP-2
|
|
AND rr.res_ruimte_key = rar.res_ruimte_key
|
|
AND rar.res_alg_ruimte_verwijder IS NULL
|
|
AND EXISTS
|
|
(SELECT 1
|
|
FROM alg_v_allonroerendgoed aog
|
|
WHERE aog.alg_ruimte_key = rar.alg_ruimte_key
|
|
AND aog.alg_locatie_key != 1181 -- NIET Heerlen
|
|
AND aog.alg_type = 'R')
|
|
AND rar.alg_ruimte_key = r.alg_ruimte_key);
|
|
|
|
-- Zorg dat voorlopig niet gebruikte WPs niet reserveerbaar (onzichtbaar) zijn!
|
|
UPDATE res_ruimte rr
|
|
SET rr.res_discipline_key = 661 -- Niet meer reserveerbare ruimte
|
|
WHERE rr.res_ruimte_verwijder IS NULL
|
|
AND ( RR.RES_DISCIPLINE_KEY = 1281 -- Secured WP-2 ROT 1A
|
|
OR RR.RES_DISCIPLINE_KEY BETWEEN 1201 AND 1225 -- ROT
|
|
OR RR.RES_DISCIPLINE_KEY = 624 -- Flex place type WP-1
|
|
OR RR.RES_DISCIPLINE_KEY = 621) -- Silent place type WP-2
|
|
AND EXISTS
|
|
(SELECT 1
|
|
FROM res_alg_ruimte rar, alg_v_allonroerendgoed aog
|
|
WHERE rar.res_ruimte_key = rr.res_ruimte_key
|
|
AND rar.alg_ruimte_key = aog.alg_ruimte_key
|
|
AND aog.alg_locatie_key != 1181 -- NIET Heerlen
|
|
AND aog.alg_type = 'R');
|
|
|
|
COMMIT;
|
|
BEGIN adm.systrackscriptId('$Id$'); END;
|
|
/
|
|
SPOOL OFF
|