DROP MATERIALIZED VIEW DBCGO_PP_MV00 ;

DROP MATERIALIZED VIEW LOG ON DBCGO_PP;

CREATE MATERIALIZED VIEW LOG ON DBCGO_PP TABLESPACE DBCGO_DATA_BIG WITH SEQUENCE, ROWID,(msisdn,terminato) INCLUDING NEW VALUES;

CREATE MATERIALIZED VIEW DBCGO_PP_MV00 
TABLESPACE DBCGO_DATA_BIG
NOLOGGING
REFRESH FAST ON COMMIT WITH ROWID
AS 
SELECT msisdn,count(*) pp_num 
FROM dbcgo_pp pp 
WHERE terminato = 1 
group by msisdn;


CREATE UNIQUE INDEX DBCGO_PP_MV00_PK ON DBCGO_PP_MV00
(MSISDN)
TABLESPACE DBCGO_IDX_BIG
NOLOGGING;

CREATE INDEX DBCGO_PP_MV00_IDX01 ON DBCGO_PP_MV00
(pp_num)
TABLESPACE DBCGO_IDX_BIG
NOLOGGING;