--
-- $Id$
--
-- <<Korte omschrijving wat het script doet>>

DEFINE thisfile = 'YKPN#41584.sql'
DEFINE dbuser   = '^YKPN'
DEFINE custid   = 'YKPN'

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

BEGIN
    fac.initsession ('NL');
END;
/

UPDATE mld_opdr o
   SET (o.mld_opdr_materiaal, o.mld_opdr_kosten) =
           (SELECT TO_NUMBER (mld_kenmerkopdr_waarde), TO_NUMBER (mld_kenmerkopdr_waarde)
              FROM mld_kenmerkopdr ko, mld_kenmerk k
             WHERE     ko.mld_kenmerk_key = k.mld_kenmerk_key
                   AND k.mld_srtkenmerk_key = 141
                   AND ko.mld_opdr_key = o.mld_opdr_key)
 WHERE EXISTS
           (SELECT mld_kenmerkopdr_key
              FROM mld_kenmerkopdr ko, mld_kenmerk k
             WHERE     ko.mld_kenmerk_key = k.mld_kenmerk_key
                   AND k.mld_srtkenmerk_key = 141
                   AND ko.mld_opdr_key = o.mld_opdr_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
