ALTER TABLE DWH.MNP_DW_SLA_MVNO_OUT
MODIFY(MSISDN VARCHAR2(15 BYTE));
ALTER TABLE MNP_DW_SLA_3GG_OUT
 ADD (DATA_FRONTIERA_SE_IN  DATE);
ALTER TABLE MNP_DW_SLA_3GG_OUT
 ADD (DATA_FRONTIERA_SE_OUT  DATE);
ALTER TABLE MNP_DW_SLA_TC_OUT
 ADD (DATA_FRONTIERA_SE_IN  DATE);
ALTER TABLE MNP_DW_SLA_TC_OUT
 ADD (DATA_FRONTIERA_SE_OUT  DATE);
CREATE TABLE MNP_DW_SLA_SE_IN_OUT
(
  UNIQUE_ID                 NUMBER              NOT NULL,
  TIPO_SLA                  VARCHAR2(5 BYTE)    NOT NULL,
  PROCESSO                  CHAR(1 BYTE)        NOT NULL,
  ID_RICHIESTA              VARCHAR2(23 BYTE)   NOT NULL,
  MESE                      VARCHAR2(7 BYTE)    NOT NULL,
  DON_EFF                   VARCHAR2(4 BYTE)    NOT NULL,
  REC_EFF                   VARCHAR2(4 BYTE)    NOT NULL,
  REC_RETE                  VARCHAR2(4 BYTE) DEFAULT 'TIMG' NOT NULL,
  DON_RETE                  VARCHAR2(4 BYTE) DEFAULT 'TIMG' NOT NULL,
  TIPO_CLIENTE              VARCHAR2(2 BYTE),
  NOME_OT                   VARCHAR2(5 BYTE),
  MSISDN                    VARCHAR2(15 BYTE)   NOT NULL,
  DATA_VALIDAZIONE_MAX      DATE,
  BUSINESS_ID_DONATING      VARCHAR2(36 BYTE),
  BUSINESS_ID_RECIPIENT     VARCHAR2(36 BYTE),
  DATA_ESPL_DON             DATE,
  DATA_RICEZIONE_RICHIESTA  DATE,
  DATA_CUT_OVER             DATE,
  DATA_ESPL_TP              DATE,
  DATA_ESPL_MSS             DATE,
  DATA_ESPL_GISP            DATE,
  DESCR_STATO               VARCHAR2(30 BYTE),
  CREDITO                   NUMBER,
  DATA_NOTIF_RECIPIENT      DATE,
  CAUSALE_RIF               VARCHAR2(100 BYTE),
  DATA_AGG                  DATE                DEFAULT sysdate               NOT NULL,
  DATA_ESTRAZIONE           DATE,
  NOME_FILE_OUT             VARCHAR2(100 BYTE),
  NOME_FILE_IN              VARCHAR2(100 BYTE),
  REQUEST_OUT               DATE,
  VALIDATION_IN             DATE,
  CEASE_OUT                 DATE,
  CREDIT_OUT                DATE,
  FRAUD_OUT                 DATE,
  AMOUNT_OUT                DATE,
  VALIDATION_OUT            DATE,
  COMPLETION1_OUT           DATE,
  CREDIT_IN                 DATE,
  FRAUD_IN                  DATE,
  AMOUNT_IN                 DATE
)
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 
NOCACHE
NOPARALLEL
NOMONITORING;
CREATE UNIQUE INDEX PK_MNP_DW_SLA_SE_IN_OUT ON MNP_DW_SLA_SE_IN_OUT
(UNIQUE_ID)
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_SE_IN_OUT ADD (
  CONSTRAINT PK_MNP_DW_SLA_SE_IN_OUT
 PRIMARY KEY
 (UNIQUE_ID)
    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 INDEX MNP_DW_SLA_SE_IN_OUT_IDX1 ON MNP_DW_SLA_SE_IN_OUT
(MESE)
LOGGING
TABLESPACE TAB_SMALL
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          10M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;

CREATE INDEX MNP_DW_SLA_SE_IN_OUT_IDX2 ON MNP_DW_SLA_SE_IN_OUT
(TIPO_SLA)
LOGGING
TABLESPACE TAB_SMALL
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          10M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


CREATE INDEX MNP_DW_SLA_SE_IN_OUT_IDX3 ON MNP_DW_SLA_SE_IN_OUT
(DON_EFF)
LOGGING
TABLESPACE TAB_SMALL
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          10M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


CREATE INDEX MNP_DW_SLA_SE_IN_OUT_IDX4 ON MNP_DW_SLA_SE_IN_OUT
(REC_EFF)
LOGGING
TABLESPACE TAB_SMALL
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          10M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


CREATE INDEX MNP_DW_SLA_SE_IN_OUT_IDX5 ON MNP_DW_SLA_SE_IN_OUT
(ID_RICHIESTA)
LOGGING
TABLESPACE TAB_SMALL
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          10M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


GRANT SELECT, REFERENCES, INSERT, UPDATE, DELETE ON  MNP_DW_SLA_SE_IN_OUT TO MNP;

CREATE SEQUENCE SEQ_DW_SLA_SE_IN_OUT
  START WITH 1
  MAXVALUE 999999999999999999999999999
  MINVALUE 1
  NOCYCLE
  CACHE 30
  NOORDER;
GRANT SELECT, REFERENCES, INSERT, UPDATE, DELETE ON  MNP_DW_SLA_3GG_OUT TO MNP;
GRANT SELECT, REFERENCES, INSERT, UPDATE, DELETE ON  MNP_DW_SLA_TC_OUT TO MNP;