DEFINE thisfile = 'SAMPLE.SQL'
DEFINE dbuser   = '^SGGR'

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 MLD_STDMELDING
SET MLD_STDMELDING_SUBJECT = 2,  MLD_STDMELDING_FREETEXT = 2;

UPDATE MLD_MELDING MM
SET MLD_MELDING_OMSCHRIJVING = (SELECT MK.MLD_KENMERKMELDING_WAARDE    
                                FROM MLD_KENMERKMELDING MK
                                WHERE MK.MLD_melding_KEY = MM.MLD_MELDING_KEY 
                                AND mk.MLD_KENMERK_KEY =683)
WHERE EXISTS (SELECT MK.MLD_KENMERKMELDING_WAARDE 
    FROM MLD_KENMERKMELDING MK
    WHERE MK.MLD_melding_KEY = MM.MLD_MELDING_KEY 
        AND mk.MLD_KENMERK_KEY =683
        AND MK.MLD_KENMERKMELDING_WAARDE IS NULL
        AND MLD_MELDING_OMSCHRIJVING IS NULL);
		
UPDATE MLD_MELDING MM
SET MLD_MELDING_OPMERKING = (SELECT MK.MLD_KENMERKMELDING_WAARDE    
                             FROM MLD_KENMERKMELDING MK
                             WHERE MK.MLD_melding_KEY = MM.MLD_MELDING_KEY 
                             AND mk.MLD_KENMERK_KEY =725)
WHERE EXISTS (SELECT MK.MLD_KENMERKMELDING_WAARDE 
FROM MLD_KENMERKMELDING MK
WHERE MK.MLD_melding_KEY = MM.MLD_MELDING_KEY 
    AND mk.MLD_KENMERK_KEY =725
    AND MK.MLD_KENMERKMELDING_WAARDE IS NOT NULL
    AND MLD_MELDING_KENMERK IS NULL);


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









