-- per donor std ABB
alter session set db_file_multiblock_read_count=64;

CREATE TABLE MNP_GISP_CESS_OUT_DON_ABB
(
  UNIQUE_ID             NUMBER                  NOT NULL,
  DATA_CREAZIONE        DATE                    DEFAULT SYSDATE,
  DATA_RICHIESTA_INVIO  DATE,
  DATA_INVIO            DATE,
  DA_SCODARE            NUMBER(1)               NOT NULL,
  DA_PROCESSARE         NUMBER(1),
  NOME_RICHIESTA        VARCHAR2(16 BYTE)       NOT NULL,
  CAS                   VARCHAR2(3 BYTE)        NOT NULL,
  NUM_TEL               VARCHAR2(13 BYTE)       NOT NULL,
  NUM_TEL_SERV_B        VARCHAR2(13 BYTE),
  NUM_ADDIZ1            VARCHAR2(13 BYTE), 
  NUM_ADDIZ2            VARCHAR2(13 BYTE),
  IMSI                  VARCHAR2(15 BYTE),
  ESPORTA_MAIN          VARCHAR2(1 BYTE),
  OLOCODE               VARCHAR2(4 BYTE)        NOT NULL,
  DATA_ESPL             DATE,	   
  TID                   VARCHAR2(23 BYTE)
)
TABLESPACE TAB_HUGE_2
PCTUSED    40
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          512M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
LOGGING 
NOCACHE
NOPARALLEL
NOMONITORING;


CREATE UNIQUE INDEX PK_MNP_GISP_CESS_OUT_DON_ABB ON MNP_GISP_CESS_OUT_DON_ABB
(UNIQUE_ID)
LOGGING
TABLESPACE TAB_IDX_HUGE_2_2
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          512M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


CREATE UNIQUE INDEX IDX_GISP_CESS_OUT_DON_ABB1 ON MNP_GISP_CESS_OUT_DON_ABB
(TID)
LOGGING
TABLESPACE TAB_IDX_HUGE_2_2
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          512M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


ALTER TABLE MNP_GISP_CESS_OUT_DON_ABB ADD (
  CONSTRAINT PK_MNP_GISP_CESS_OUT_DON_ABB
 PRIMARY KEY
 (UNIQUE_ID)
    USING INDEX 
    TABLESPACE TAB_IDX_HUGE_2_2
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          512M
                NEXT             10M
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
               ));

ALTER TABLE MNP_GISP_CESS_OUT_DON_ABB ADD (
  CONSTRAINT IDX_MNP_GISP_CESS_OUT_DON_ABB
 UNIQUE (TID));

 -- per donor std PP
 CREATE TABLE MNP_GISP_CESS_OUT_DON_PP
(
  UNIQUE_ID             NUMBER                  NOT NULL,
  DATA_CREAZIONE        DATE                    DEFAULT SYSDATE,
  DATA_RICHIESTA_INVIO  DATE,
  DATA_INVIO            DATE,
  DA_SCODARE            NUMBER(1)               NOT NULL,
  DA_PROCESSARE         NUMBER(1),
  NOME_RICHIESTA        VARCHAR2(16 BYTE)       NOT NULL,
  CAS                   VARCHAR2(3 BYTE)        NOT NULL,
  NUM_TEL               VARCHAR2(13 BYTE)       NOT NULL,
  NUM_TEL_SERV_B        VARCHAR2(13 BYTE),
  IMSI                  VARCHAR2(15 BYTE),
  ESPORTA_MAIN          VARCHAR2(1 BYTE),
  OLOCODE               VARCHAR2(4 BYTE)        NOT NULL,
  DATA_ESPL             DATE,	   
  TID                   VARCHAR2(23 BYTE)
)
TABLESPACE TAB_HUGE_2
PCTUSED    40
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          512M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
LOGGING 
NOCACHE
NOPARALLEL
NOMONITORING;


CREATE UNIQUE INDEX PK_MNP_GISP_CESS_OUT_DON_PP ON MNP_GISP_CESS_OUT_DON_PP
(UNIQUE_ID)
LOGGING
TABLESPACE TAB_IDX_HUGE_2_2
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          512M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


CREATE UNIQUE INDEX IDX_GISP_CESS_OUT_DON_PP1 ON MNP_GISP_CESS_OUT_DON_PP
(TID)
LOGGING
TABLESPACE TAB_IDX_HUGE_2_2
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          512M
            NEXT             10M
            MINEXTENTS       1
            MAXEXTENTS       2147483645
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
           )
NOPARALLEL;


ALTER TABLE MNP_GISP_CESS_OUT_DON_PP ADD (
  CONSTRAINT PK_MNP_GISP_CESS_OUT_DON_PP
 PRIMARY KEY
 (UNIQUE_ID)
    USING INDEX 
    TABLESPACE TAB_IDX_HUGE_2_2
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          512M
                NEXT             10M
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
               ));

ALTER TABLE MNP_GISP_CESS_OUT_DON_PP ADD (
  CONSTRAINT IDX_MNP_GISP_CESS_OUT_DON_PP
 UNIQUE (TID))
/