--
-- $Id$
--
-- <<Gebouwverantwoordelijken aanpassen>>

DEFINE thisfile = 'RABO#56149.SQL'
DEFINE dbuser   = '^RABO'

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_gebouw 
SET prs_perslid_key_verantw = 6023		-- Key voor Mitchel Vos
WHERE alg_gebouw_key IN 
	(SELECT g.alg_gebouw_key
	FROM alg_gebouw g, alg_district d, alg_locatie l
	WHERE d.alg_district_key = l.alg_district_key 
	AND l.alg_locatie_key = g.alg_locatie_key
	AND d.alg_district_key IN (
		483,
		484,
		485,
		486,
		41,
		265,
		487,
		488,
		489));          

UPDATE alg_gebouw 
SET prs_perslid_key_verantw = 333		-- Key voor Dennis Kunnen
WHERE alg_gebouw_key IN 
	(SELECT g.alg_gebouw_key
	FROM alg_gebouw g, alg_district d, alg_locatie l
	WHERE d.alg_district_key = l.alg_district_key 
	AND l.alg_locatie_key = g.alg_locatie_key
	AND d.alg_district_key IN (
		401,
		302,
		303,
		304,
		241,
		481,
		482));

UPDATE alg_gebouw 
SET prs_perslid_key_verantw = 8704		-- Key voor Charles Israel
WHERE alg_gebouw_key IN 
	(SELECT g.alg_gebouw_key
	FROM alg_gebouw g, alg_district d, alg_locatie l
	WHERE d.alg_district_key = l.alg_district_key 
	AND l.alg_locatie_key = g.alg_locatie_key
	AND d.alg_district_key IN (
		322,
		493,
		321,
		494,
		495,
		496,
		305,
		497));

UPDATE alg_gebouw 
SET prs_perslid_key_verantw = 416		-- Key voor Barry Sommers
WHERE alg_gebouw_key IN 
	(SELECT g.alg_gebouw_key
	FROM alg_gebouw g, alg_district d, alg_locatie l
	WHERE d.alg_district_key = l.alg_district_key 
	AND l.alg_locatie_key = g.alg_locatie_key
	AND d.alg_district_key IN (
		490,
		491,
		281,
		101,
		492,
		263,
		221,
		201,
		1));

------ 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
