LPNL#77267 -- AiAi op cnt.getnieuwsteversiekey
svn path=/Customer/; revision=59578
This commit is contained in:
63
onces/LPNL/LPNL#77267.sql
Normal file
63
onces/LPNL/LPNL#77267.sql
Normal file
@@ -0,0 +1,63 @@
|
||||
--
|
||||
-- $Id$
|
||||
--
|
||||
-- Korte beschrijving wat het script doet
|
||||
-- Verwijder onterecht aangemaakte contracten.
|
||||
--
|
||||
DEFINE thisfile = 'LPNL#77267.SQL'
|
||||
DEFINE dbuser = '^LPNL'
|
||||
|
||||
SET ECHO ON
|
||||
SET DEFINE ON
|
||||
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
|
||||
COLUMN fcltcusterr NEW_VALUE fcltcusterr NOPRINT;
|
||||
WHENEVER SQLERROR CONTINUE;
|
||||
SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL;
|
||||
SPOOL &fcltlogfile
|
||||
WHENEVER SQLERROR EXIT;
|
||||
SELECT adm.checkscriptcust('&dbuser') AS fcltcusterr FROM DUAL;
|
||||
WHENEVER SQLERROR CONTINUE;
|
||||
PROMPT &fcltcusterr
|
||||
SET DEFINE OFF
|
||||
|
||||
------ payload begin ------
|
||||
|
||||
DECLARE
|
||||
CURSOR c IS
|
||||
SELECT MAX (cnt_contract_key) cnt_contract_key
|
||||
FROM cnt_contract
|
||||
WHERE cnt_contract_versie = '1'
|
||||
GROUP BY cnt_contract_nummer_intern
|
||||
HAVING COUNT (*) > 1;
|
||||
BEGIN
|
||||
FOR rec IN c
|
||||
LOOP
|
||||
DELETE cnt_kenmerkcontract
|
||||
WHERE cnt_contract_key = rec.cnt_contract_key;
|
||||
|
||||
DELETE cnt_factuurschema
|
||||
WHERE cnt_contract_key = rec.cnt_contract_key;
|
||||
|
||||
DELETE cnt_contract_plaats
|
||||
WHERE cnt_contract_key = rec.cnt_contract_key;
|
||||
|
||||
DELETE cnt_contract
|
||||
WHERE cnt_contract_key = rec.cnt_contract_key;
|
||||
|
||||
DBMS_OUTPUT.put_line('Contract verwijderd: ' || rec.cnt_contract_key );
|
||||
END LOOP;
|
||||
COMMIT;
|
||||
END;
|
||||
/
|
||||
|
||||
------ 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
|
||||
Reference in New Issue
Block a user