--
-- $Id$
--
-- Aanmaken klantspecifieke tabel die nodig is voor de Firmbase (parkeersysteem) koppeling

DEFINE thisfile = 'FCLT#56045_1.SQL'
DEFINE dbuser   = '^VOLK'

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

CREATE TABLE VOLK_REGISTRATIES_FIRMBASE
(
    bez_bezoeker_key  NUMBER (10),    
    bez_startdatum    DATE,
    bez_einddatum     DATE,   
    kenteken          VARCHAR2 (30),
    visitor_profile   VARCHAR2 (30)
);  

COMMIT;

UPDATE alg_gebouw gb
   SET gb.mld_dienstniveau_key =
           (SELECT DECODE (alg_srtgebouw_upper,
                           'GEA', 1,
                           'GR KANT', 2,
                           'REGIOBANK', 3,
                           'WINKEL (FN)', 4,
                           'WINKEL (LD)', 5)    dienstniv
              FROM alg_gebouw g, alg_srtgebouw sg
             WHERE g.alg_srtgebouw_key = sg.alg_srtgebouw_key
             AND g.alg_gebouw_key = gb.alg_gebouw_key)
             WHERE gb.mld_dienstniveau_key is null;
 
COMMIT; 
 
------ 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
