--Eseguire come utente DWH




-- creazione tabella per report SLA 3gg. --
 
CREATE TABLE MNP_DW_SLA_3GG_OUT
(
  ID_RICHIESTA           VARCHAR2(23 BYTE)      NOT NULL,
  TIPO_MESSAGGIO         VARCHAR2(23 BYTE)      NOT NULL,
  ID_PROG                NUMBER                 NOT NULL,
  DATA_MESSAGGIO         DATE                   NOT NULL,
  DONOR_EFFETTIVO        VARCHAR2(4 BYTE)       NOT NULL,
  RECIPIENT_EFFETTIVO    VARCHAR2(4 BYTE)       NOT NULL,
  TERZA_PARTE            VARCHAR2(4 BYTE),
  NOME_FILE              VARCHAR2(27 BYTE)      NULL,
  NUMERO_GIORNI_RITARDO  NUMBER                 DEFAULT 0                     NOT NULL,
  PENALE                 NUMBER                 DEFAULT 0                     NOT NULL,
  T_INIZIALE             DATE                   NOT NULL,
  T_FINALE               DATE                   NOT NULL,
  PROCESSO               VARCHAR2(1 BYTE)       NOT NULL,
  DATA_CUT_OVER          DATE                   NOT NULL,
  numero_sim             NUMBER                 DEFAULT 0
)
TABLESPACE TAB_SMALL
PCTUSED    40
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          10M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
LOGGING 
NOCOMPRESS 
NOCACHE
NOPARALLEL
NOMONITORING;


CREATE UNIQUE INDEX MNP_DW_SLA_3GG_OUT_PK ON MNP_DW_SLA_3GG_OUT
(ID_RICHIESTA, TIPO_MESSAGGIO, ID_PROG)
LOGGING
TABLESPACE TAB_SMALL
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          10M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


ALTER TABLE MNP_DW_SLA_3GG_OUT ADD (
  CONSTRAINT MNP_DW_SLA_3GG_OUT_PK
 PRIMARY KEY
 (ID_RICHIESTA, TIPO_MESSAGGIO, ID_PROG)
    USING INDEX 
    TABLESPACE TAB_SMALL
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          10M
                NEXT             10M
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
               ));


CREATE SEQUENCE SEQ_ID_PROG
  START WITH 1
  MAXVALUE 999999999999999999999999999
  MINVALUE 1
  NOCYCLE
  NOCACHE
  NOORDER;


