BLOS#68339 -- Oncescript om de LOCATIES onder een nieuwe DISTRICT-indeling te krijgen ivm organisatie-wijziging intern BLOS

svn path=/Customer/; revision=53692
This commit is contained in:
Jos Migo
2021-11-14 20:48:33 +00:00
parent 4d54e7d9bd
commit b126f27d92

57
onces/BLOS/BLOS#68339.sql Normal file
View File

@@ -0,0 +1,57 @@
-- Customer specific once-script voor BLOS
-- $Id$
--
-- Oncescript om de LOCATIES onder een nieuwe DISTRICT-indeling te krijgen ivm organisatie-wijziging intern BLOS
DEFINE thisfile = 'BLOS#68339.SQL'
DEFINE dbuser = '^BLOS'
SET ECHO ON
SET DEFINE ON
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
WHENEVER SQLERROR EXIT;
SELECT adm.scriptspoolfile('&dbuser', '&thisfile') AS fcltlogfile FROM DUAL;
WHENEVER SQLERROR CONTINUE;
SPOOL &fcltlogfile
SET DEFINE OFF
------ payload begin ------
UPDATE alg_locatie loc
SET loc.alg_district_key =
(
SELECT d.alg_district_key
FROM blos_v_cluster_locaties v, alg_district d, alg_locatie l
WHERE d.alg_district_upper = v.cluster_code
AND v.alg_locatie_key = l.alg_locatie_key
AND d.alg_district_verwijder IS NULL
AND l.alg_locatie_verwijder IS NULL
AND l.alg_locatie_key = loc.alg_locatie_key
AND l.alg_district_key <> d.alg_district_key
)
WHERE loc.alg_locatie_key IN
(
SELECT v.alg_locatie_key
FROM blos_v_cluster_locaties v, alg_district d, alg_locatie l
WHERE d.alg_district_upper = v.cluster_code
AND v.alg_locatie_key = l.alg_locatie_key
AND d.alg_district_verwijder IS NULL
AND l.alg_locatie_verwijder IS NULL
AND l.alg_district_key <> d.alg_district_key
)
;
------ payload end ------
SET DEFINE OFF
BEGIN adm.systrackscriptId ('$Id$', 1); END;
/
COMMIT;
SET ECHO OFF
SPOOL OFF
SET DEFINE ON
PROMPT Logfile of this upgrade is: &fcltlogfile