--
-- $Id$
--
-- Past de EXC_IMPORT trigger aan in de hoop dat het deadlocks vermindert
-- Dit komt eigenlijk pas met 2023.3/DB46 maar doen we alvast bij PROR
--
DEFINE thisfile = 'PROR#79462.sql'
DEFINE dbuser   = 'PROR'

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

-- Merk op: met DB46 wordt hij netjes hernoemd naar exc_t_exc_import_B_I

CREATE OR REPLACE TRIGGER exc_t_exc_import_B_IU
BEFORE INSERT ON exc_import
FOR EACH ROW
BEGIN
    IF :new.exc_import_key IS NULL THEN SELECT exc_s_import_key.nextval INTO :new.exc_import_key FROM DUAL; END IF;
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
