57 lines
1.8 KiB
SQL
57 lines
1.8 KiB
SQL
--
|
|
-- $Id$
|
|
--
|
|
-- Script containing customer specific sql statements for the KFNS database
|
|
-- Script dat alle opdrachten die nog niet zijn afgemeld/afgewezen/verwerkt (3,4,5,8,10)
|
|
-- en waar een contract aan vast zit dat gesloten is (1) naar status afgemeld (6) zet via ORDUPD (60)
|
|
|
|
DEFINE thisfile = 'KFNS#53661.SQL'
|
|
DEFINE dbuser = '^KFNS'
|
|
DEFINE custid = 'KFNS'
|
|
|
|
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 ------
|
|
|
|
INSERT INTO fac_tracking (fac_tracking_datum,
|
|
fac_srtnotificatie_key,
|
|
fac_tracking_refkey,
|
|
fac_tracking_oms)
|
|
SELECT SYSDATE,
|
|
60,
|
|
mld_opdr_key,
|
|
'Opdracht op verzoek van Kien afgemeld'
|
|
FROM mld_opdr o, cnt_contract c
|
|
WHERE o.cnt_contract_key = c.cnt_contract_key
|
|
AND o.mld_statusopdr_key IN (3, 4, 5, 8, 10)
|
|
AND c.cnt_contract_verwijder IS NULL
|
|
AND c.cnt_contract_status = 1;
|
|
|
|
UPDATE mld_opdr
|
|
SET mld_statusopdr_key = 6
|
|
WHERE mld_opdr_key IN
|
|
(SELECT mld_opdr_key
|
|
FROM mld_opdr o, cnt_contract c
|
|
WHERE o.cnt_contract_key = c.cnt_contract_key
|
|
AND o.mld_statusopdr_key IN (3, 4, 5, 8, 10)
|
|
AND c.cnt_contract_verwijder IS NULL
|
|
AND c.cnt_contract_status = 1);
|
|
|
|
------ payload end ------
|
|
|
|
SET DEFINE OFF
|
|
BEGIN adm.systrackscriptId ('$Id$', 0); END;
|
|
/
|
|
|
|
COMMIT;
|
|
SET ECHO OFF
|
|
SPOOL OFF
|
|
SET DEFINE ON
|
|
PROMPT Logfile of this upgrade is: &fcltlogfile |