IVET#73753 Sleepbaar thema/Bugfix(es) trigger

svn path=/Customer/trunk/; revision=56985
This commit is contained in:
Maarten van der Heide
2022-08-24 08:12:41 +00:00
parent 7b89fb2abe
commit f754e29b0f

View File

@@ -1,9 +1,26 @@
-- Script containing customer specific db-configuration for PHBF.
-- (c) 2014 SG|facilitor bv
--
-- Support: +31 53 4800700
set echo on
spool xphbf.lst
-- $Id$
--
-- Script containing customer specific db-configuration for IVET.
DEFINE thisfile = 'PHBF.SQL'
DEFINE dbuser = '^PHBF'
SET ECHO ON
SET DEFINE ON
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
COLUMN fcltcusttxt NEW_VALUE fcltcusttxt NOPRINT;
WHENEVER SQLERROR CONTINUE;
SELECT adm.getscriptspoolfile('&thisfile') AS fcltlogfile FROM DUAL;
SPOOL &fcltlogfile
WHENEVER SQLERROR EXIT;
SELECT adm.checkscriptcust('&dbuser') AS fcltcusttxt FROM DUAL;
WHENEVER SQLERROR CONTINUE;
---------------------------------------
PROMPT &fcltcusttxt
---------------------------------------
SET DEFINE OFF
------ payload begin ------
/* Formatted on 2-3-2010 21:00:14 (QP5 v5.115.810.9015) */
CREATE OR REPLACE VIEW phbf_v_thema_vloerafw
@@ -42,7 +59,7 @@ AS
AND ok.alg_onrgoedkenmerk_waarde =
ud.fac_usrdata_key);
/* Formatted on 28-3-2014 15:48:12 (QP5 v5.136.908.31019) */
/* Formatted on 23-8-2022 18:25:45 (QP5 v5.136.908.31019) */
CREATE OR REPLACE TRIGGER phbf_t_thema_vloerafw_i_iu
INSTEAD OF INSERT OR UPDATE
ON phbf_v_thema_vloerafw
@@ -50,9 +67,11 @@ BEGIN
IF UPDATING -- oude hard weggooien; dus DELETE (lekker opruimen)!
THEN
DELETE FROM alg_onrgoedkenmerk
WHERE alg_kenmerk_key = 1020 -- Vloerafwerking
AND alg_onrgoed_key = :new.alg_ruimte_key
AND alg_onrgoedkenmerk_waarde <> TO_CHAR (:new.waarde_key);
WHERE alg_onrgoed_key = :new.alg_ruimte_key
AND alg_onrgoed_niveau = 'R'
AND alg_kenmerk_key = 1020
AND (alg_onrgoedkenmerk_waarde IS NULL -- IVET#73753/73776: Zou nooit NULL mogen zijn, maar was dat ergens wel!?
OR fac.safe_to_number (alg_onrgoedkenmerk_waarde) <> :new.waarde_key);
END IF;
BEGIN
@@ -65,7 +84,7 @@ BEGIN
VALUES (:new.alg_ruimte_key,
'R',
1020,
TO_CHAR (:new.waarde_key));
:new.waarde_key);
END IF;
EXCEPTION
WHEN DUP_VAL_ON_INDEX -- was al aanwezig
@@ -75,9 +94,14 @@ BEGIN
END;
/
BEGIN adm.systrackscriptId('$Id$', 0); END;
/
BEGIN fac.registercustversion('PHBF', 0); END;
------ payload end ------
SET DEFINE OFF
BEGIN adm.systrackscriptId ('$Id$', 0); END;
/
COMMIT;
spool off
SET ECHO OFF
SPOOL OFF
SET DEFINE ON
PROMPT Logfile of this upgrade is: &fcltlogfile