spool /mnpapp/log/script/dbc_cs77_slamvno.log;

SELECT * from MNP_MVNO_NOT_SLA_REC_OUT where DA_SCODARE=1 and data_creazione<sysdate;

update MNP_MVNO_NOT_SLA_REC_OUT set DA_SCODARE=5 where DA_SCODARE=1 and data_creazione<sysdate;

SELECT * from MNP_MVNO_NOT_SLA_DON_OUT where DA_SCODARE=1 and data_creazione<sysdate;

update MNP_MVNO_NOT_SLA_DON_OUT set DA_SCODARE=5 where DA_SCODARE=1 and data_creazione<sysdate;

delete from MNP_MVNO_DETT_NOT_SLA_REC_OUT where id_notifica in
 (select UNIQUE_ID from MNP_MVNO_NOT_SLA_REC_OUT where da_scodare = 5);
 
delete from MNP_MVNO_DETT_NOT_SLA_DON_OUT where id_notifica in 
 (select UNIQUE_ID from MNP_MVNO_NOT_SLA_DON_OUT where da_scodare = 5);
 
update MNP_MVNO_NOT_SLA_REC_OUT set LISTA_SLA ='SLA0' where ID_RICHIESTA in 
(select r.ID_RICHIESTA from MNP_MVNO_NOT_SLA_REC_OUT s,MNP_GESTIONE_RICHIESTA_REC r where da_scodare = 5 
 and s.id_richiesta=r.id_richiesta and r.stato= 5);

update MNP_MVNO_NOT_SLA_REC_OUT set LISTA_SLA ='SLA0,SLA1' where ID_RICHIESTA in 
(select r.ID_RICHIESTA from MNP_MVNO_NOT_SLA_REC_OUT s,MNP_GESTIONE_RICHIESTA_REC r where da_scodare = 5 
 and s.id_richiesta=r.id_richiesta and r.stato= 7);

update MNP_MVNO_NOT_SLA_REC_OUT set LISTA_SLA ='SLA0,SLA1' where ID_RICHIESTA in 
(select r.ID_RICHIESTA from MNP_MVNO_NOT_SLA_REC_OUT s,MNP_GEST_RICH_REC_VIRT r where da_scodare = 5 
 and s.id_richiesta=r.id_richiesta and r.stato= 7); 
 
 update MNP_MVNO_NOT_SLA_REC_OUT set LISTA_SLA ='SLA0,SLA1,SLA2,SLA3' where ID_RICHIESTA in 
(select r.ID_RICHIESTA from MNP_MVNO_NOT_SLA_REC_OUT s,MNP_GESTIONE_RICHIESTA_REC r where da_scodare = 5 
 and s.id_richiesta=r.id_richiesta and r.stato= 12);
 
 update MNP_MVNO_NOT_SLA_REC_OUT set LISTA_SLA ='SLA0,SLA1,SLA2,SLA3' where ID_RICHIESTA in 
(select r.ID_RICHIESTA from MNP_MVNO_NOT_SLA_REC_OUT s,MNP_GEST_RICH_REC_VIRT r where da_scodare = 5 
 and s.id_richiesta=r.id_richiesta and r.stato= 12); 
 
spool off;
