--
-- $Id$
--
-- Update registratiedatum object met waarde van kenmerk Extra informatie (key 2765)

DEFINE thisfile = 'SUTF#47828.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 ins_deel d
   SET ins_deel_aanmaak =
          (SELECT TO_DATE (ins_kenmerkdeel_waarde, 'DD-MM-YYYY')
             FROM ins_kenmerkdeel kd
            WHERE ins_kenmerk_key = 2765
                  AND TRUNC (ins_kenmerkdeel_aanmaak) =
                        TO_DATE ('23-10-2017', 'DD-MM-YYYY')
                  AND kd.ins_deel_key = d.ins_deel_key)
 WHERE ins_deel_key IN
             (SELECT ins_deel_key
                FROM ins_kenmerkdeel kd
               WHERE ins_kenmerk_key = 2765
                     AND TRUNC (ins_kenmerkdeel_aanmaak) =
                           TO_DATE ('23-10-2017', 'DD-MM-YYYY')
                     AND kd.ins_deel_key = d.ins_deel_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