-- $Id$
--
-- Init voor opzetten nieuwe klantomgeving PCH Gemeente Heerlen

DEFINE thisfile = 'PGHE2.SQL'
DEFINE dbuser   = '^PGHE'

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

DROP TABLE pchx_monitoring

CREATE TABLE pchx_monitoring
(
    melding_key             NUMBER (10),
    afw                     VARCHAR2 (10),
    indult                  VARCHAR2 (3),
    respijt                 VARCHAR2 (50),
    locatie                 VARCHAR2 (10),
    gebouw                  VARCHAR2 (30),
    verdieping              NUMBER (3),
    ruimte                  VARCHAR2 (50),
    omschrijving            VARCHAR2 (60),
    begin                   DATE,
    gereed                  DATE,
    verwerkt                DATE,
    thtijdstip              DATE,
    eenheid                 VARCHAR2 (1),
    tht                     NUMBER (10, 5),
    wht                     NUMBER (10, 5),
    wht_tht                 NUMBER (10, 5),
    regime                  NUMBER (3),
    groep                   VARCHAR2 (30),
    typekorting             VARCHAR2 (4),
    basiskorting            NUMBER (8),
    variabelekorting        NUMBER (8),
    dienst                  VARCHAR2 (60),
    stdmelding_key          NUMBER (10),
    wegingsfactor           NUMBER (10),
    totaal                  NUMBER (10, 2),
    totaal_index            NUMBER (10, 2),
    kinderen                VARCHAR2 (1000),
    export_datum            DATE,
    overlappend             VARCHAR2 (100),
    prs_bedrijf_naam        VARCHAR2 (60),
    klant_melding           NUMBER (1),
    melding_omschrijving    VARCHAR2 (4000),
    melding_opmerking       VARCHAR2 (4000),
    gekoppeld               VARCHAR2 (100),
    totaal_z_respijt        NUMBER (10, 2)
);


CREATE TABLE pghe_imp_storing_regime
(
  r_codering             VARCHAR2(100),
  omschrijving           VARCHAR2(100),
  ruimten                VARCHAR2(100),
  storing_os             VARCHAR2(100),
  stdmelding             VARCHAR2(100),
  vakgroep               VARCHAR2(100),
  vakgroeptype           VARCHAR2(100),
  tht_os                 VARCHAR2(100),
  tht                    VARCHAR2(100),
  tht_eenheid            VARCHAR2(100),
  bk                     VARCHAR2(100),
  vk                     VARCHAR2(100),
  alg_srtruimte_key      NUMBER,
  mld_stdmelding_key     NUMBER,
  mld_discipline_key     NUMBER,
  ins_srtdiscipline_key  NUMBER
);


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