--
-- $Id$
--
-- Update alle contracten van de soort gebruikersovereenkomst (key 22) zodat nieuwe versies eigen contracten worden

DEFINE thisfile = 'VEBE#37435.SQL'
DEFINE dbuser   = '^VEBE'
DEFINE custid   = 'VEBE'

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 cnt_contract
   SET cnt_contract_nummer_intern =
          cnt_contract_nummer_intern || '-' || cnt_contract_versie
 WHERE cnt_contract_versie is not null AND ins_discipline_key = 22;

UPDATE cnt_contract
   SET cnt_contract_versie = NULL
 WHERE cnt_contract_versie IS NOT NULL and cnt_contract_nummer_intern like '%-%'
     AND ins_discipline_key =  22;
------ 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

-- @@ &custid