-- $Id$
--
-- Allen ingevoerde meldingen en opdrachten verwijderen.

DEFINE thisfile = 'PGHE#68684.SQL'
DEFINE dbuser   = '^PGHE'

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

DELETE mld_opdr;

DELETE mld_melding;

-- Verwijder de tracking
DELETE fac_tracking t
 WHERE EXISTS
           (SELECT 1
              FROM fac_srtnotificatie sn
             WHERE     sn.fac_srtnotificatie_key = t.fac_srtnotificatie_key
                   AND (   fac_srtnotificatie_xmlnode = 'melding'
                        OR fac_srtnotificatie_xmlnode = 'opdracht'));

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