--
-- $Id$
--
-- Update standaardmeldingen zet het verplichtniveau naar gebouw voor alle standaardmeldingen 
-- binnen vakgroeptypen 'huisvesting' (63), 'inventaris' (62), 'logistiek' (64) en schoonmaak (61)

DEFINE thisfile = 'SUTF#40891.SQL'
DEFINE dbuser   = '^SUTF'
DEFINE custid   = 'SUTF'

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 mld_stdmelding
   SET alg_onrgoed_niveau = 'G'
 WHERE mld_stdmelding_key IN
             (SELECT mld_stdmelding_key
                FROM mld_stdmelding std, mld_discipline d
               WHERE     std.mld_ins_discipline_key = d.ins_discipline_key
                     AND d.ins_srtdiscipline_key IN (61, 62, 63, 64)
                     AND mld_stdmelding_verwijder IS NULL
                     AND alg_onrgoed_niveau != 'G');

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