45 lines
1.7 KiB
SQL
45 lines
1.7 KiB
SQL
--
|
|
-- $Id$
|
|
--
|
|
-- Dubbele actieve ins_deelsrtcontrole records verwijderen.
|
|
|
|
DEFINE thisfile = 'PLAT#53124.sql'
|
|
DEFINE dbuser = '^WOMA'
|
|
|
|
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 FROM ins_deelsrtcontrole c
|
|
WHERE c.ins_deelsrtcontrole_key IN (SELECT maxdeel
|
|
FROM ( SELECT idsc.ins_deel_key,
|
|
COUNT(idsc.ins_deel_key) aantal,
|
|
MAX(idsc.ins_deelsrtcontrole_key) maxdeel,
|
|
MIN(idsc.ins_deelsrtcontrole_key) mindeel,
|
|
idsc.ins_scenario_key
|
|
FROM ins_deelsrtcontrole idsc
|
|
WHERE idsc.ins_deelsrtcontrole_status IN (0, 2)
|
|
GROUP BY idsc.ins_deel_key,
|
|
idsc.ins_scenario_key) insp
|
|
WHERE insp.aantal > 1
|
|
AND insp.ins_scenario_key = c.ins_scenario_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
|