--
-- $Id$
--
-- Script om verplichte onzichtbare kenmerken niet verplicht te maken

DEFINE thisfile = 'FCLT#64207.SQL'
DEFINE dbuser   = '*'

SET ECHO ON
SET DEFINE ON
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
COLUMN fcltcusterr NEW_VALUE fcltcusterr NOPRINT;
WHENEVER SQLERROR CONTINUE;
SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL;
SPOOL &fcltlogfile
WHENEVER SQLERROR EXIT;
SELECT adm.checkscriptcust('&dbuser') AS fcltcusterr FROM DUAL;
WHENEVER SQLERROR CONTINUE;
PROMPT &fcltcusterr
SET DEFINE OFF

------ payload begin ------

UPDATE mld_kenmerk
   SET mld_kenmerk_verplicht = NULL
 WHERE mld_kenmerk_key IN
           (SELECT mld_kenmerk_key
              FROM mld_kenmerk mk, mld_srtkenmerk sk
             WHERE     mk.mld_srtkenmerk_key = sk.mld_srtkenmerk_key
                   AND sk.mld_srtkenmerk_verwijder IS NULL
                   AND mld_kenmerk_verplicht = 1
                   AND (   mld_kenmerk_volgnummer < 1
                        OR mld_kenmerk_toonbaar = 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