-- Customer specific once-script to KFNS#36050.
--
-- (c) 2016 SG|facilitor bv
--
-- Support: +31 53 4800700
SET ECHO ON
SPOOL xKFNS36050.lst
SET DEFINE OFF

/* Formatted on 11-4-2016 12:18:22 (QP5 v5.136.908.31019) */
/*
SELECT o.mld_opdr_key,
          TO_CHAR (o.mld_melding_key)
       || '/'
       || TO_CHAR (o.mld_opdr_bedrijfopdr_volgnr)
          opdr_id,
       o.mld_opdr_kosten kosten
  FROM mld_opdr o
 WHERE     o.mld_opdr_ordernr = '2016-03'
       AND o.mld_typeopdr_key = 282                        -- Contractopdracht
       AND o.mld_opdr_kosten != 0
       AND EXISTS
             (SELECT 1
                FROM cnt_contract
               WHERE ins_discipline_key = 143 -- Variabele contracten (kan niet anders)
                     AND cnt_contract_key = o.cnt_contract_key);
*/

UPDATE mld_opdr o
   SET o.mld_opdr_kosten = 0
 WHERE     o.mld_opdr_ordernr = '2016-03'
       AND o.mld_typeopdr_key = 282                        -- Contractopdracht
       AND o.mld_opdr_kosten != 0
       AND EXISTS
             (SELECT 1
                FROM cnt_contract
               WHERE ins_discipline_key = 143 -- Variabele contracten (kan niet anders)
                     AND cnt_contract_key = o.cnt_contract_key);

COMMIT;
BEGIN adm.systrackscriptId('$Id: '); END;
/
SPOOL OFF
