Files
gateway-mnp-dbc/dbcmnpsrc/FE/mnpapp/script/dbUpDate/KitAprile06/dbcgoDML.sql
2024-05-13 12:54:14 +02:00

544 lines
31 KiB
MySQL

--da eseguire come utente DBCGO
-------------------------------------------------------------------------
update DBCGO_GESTIONE_RICHIESTA
set DATA_TRANSIZIONE_STATO_GRP = DATA_TRANSIZIONE_STATO;
alter table DBCGO_GESTIONE_RICHIESTA
modify (DATA_TRANSIZIONE_STATO_GRP NOT NULL);
update DBCGO_GESTIONE_RICHIESTA o
SET o.codice_operatore_donating = (
select g.codice_operatore_donating
FROM mnp_gestione_richiesta@MNP g
where o.id_richiesta=g.id_richiesta );
alter table DBCGO_GESTIONE_RICHIESTA
modify (CODICE_OPERATORE_DONATING NOT NULL);
-------------------------------------------------------------------------
update DBCGO_GESTIONE_RICHIESTA_REC
set DATA_TRANSIZIONE_STATO_GRP = DATA_TRANSIZIONE_STATO;
alter table DBCGO_GESTIONE_RICHIESTA_REC
modify (DATA_TRANSIZIONE_STATO_GRP NOT NULL);
update DBCGO_GESTIONE_RICHIESTA_REC o
SET (o.codice_operatore_recipient,o.codice_gruppo) = (
select g.codice_operatore_recipient,g.codice_gruppo
FROM mnp_gestione_richiesta_rec@MNP g
where o.id_richiesta=g.id_richiesta );
alter table DBCGO_GESTIONE_RICHIESTA_REC
modify (CODICE_OPERATORE_RECIPIENT NOT NULL);
-------------------------------------------------------------------------
--DBCGO_STATO
update dbcgo_stato set stato_type=1 --finale positivo
where id_stato in (16);
update dbcgo_stato set stato_type=2 --finale negativo
where id_stato in (4,10,12,22);
-------------------------------------------------------------------------
update dbcgo_stato_rec set stato_type=1 --finale positivo
where id_stato in (12);
update dbcgo_stato_rec set stato_type=2 --finale negativo
where id_stato in (1,5,7,9,14,17,16);
-------------------------------------------------------------------------
INSERT INTO DBCGO_STATO_POR ( ID_STATO, DESCR_STATO, ID_STATO_GRP, DESCR, STATO_TYPE ) VALUES (1, 'ACQUISITA', 1, 'ACQUISITA',0);
INSERT INTO DBCGO_STATO_POR ( ID_STATO, DESCR_STATO, ID_STATO_GRP, DESCR, STATO_TYPE ) VALUES (2, 'SCARTATA', 2, 'SCARTATA',2);
INSERT INTO DBCGO_STATO_POR ( ID_STATO, DESCR_STATO, ID_STATO_GRP, DESCR, STATO_TYPE ) VALUES (3, 'ATTESA_EVASIONE', 3, 'ATTESA_EVASIONE',0);
INSERT INTO DBCGO_STATO_POR ( ID_STATO, DESCR_STATO, ID_STATO_GRP, DESCR, STATO_TYPE ) VALUES (4, 'EVASA', 4, 'EVASA',0);
INSERT INTO DBCGO_STATO_POR ( ID_STATO, DESCR_STATO, ID_STATO_GRP, DESCR, STATO_TYPE ) VALUES (5, 'NON_EVASA', 5, 'NON_EVASA',0);
INSERT INTO DBCGO_STATO_POR ( ID_STATO, DESCR_STATO, ID_STATO_GRP, DESCR, STATO_TYPE ) VALUES (6, 'ESPLETATA', 6, 'ESPLETATA',1);
INSERT INTO DBCGO_STATO_POR ( ID_STATO, DESCR_STATO, ID_STATO_GRP, DESCR, STATO_TYPE ) VALUES (7, 'NON_EVASA_INVIATA', 7, 'NON_EVASA_INVIATA',0);
-----------------------------
--SAP_ANAG_FV - dealer fittizi
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('130','130','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('131','131','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('132','132','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('133','133','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('134','134','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('135','135','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('136','136','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('137','137','CUP','CUP',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('118','118','CCBU','CCBU',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('119','119','CCCO','CCCO',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('140','140','TS','TS',1,1);
insert into SAP_ANAG_FV(COD_ID, COD_ID_PADRE, MERCATO, DISLOCAZIONE_TERR, STATO, DEALER_TYPE) values ('141','141','TS','TS',1,1);
-------------------------------------------------------------------------
--DBCGO_LOV - PROCESS
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'PROCESS', 'D', 'DONOR');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'PROCESS', 'R', 'RECIPIENT');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'PROCESS', 'P', 'TERZA PARTE');
-------------------------------------------------------------------------
--DBCGO_LOV - OT_REC
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','C','CENTRO');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','CN','CENTRO NORD');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','LO','LOMBARDIA');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','NE','NORD EST');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','NO','NORD OVEST');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','S1','SUD 1');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','S2','SUD 2');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','N8VS','Grande Distrib. Org.');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','VEDG','Direz. Gen. Diffusivi');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','CUP','CUP');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','CCCO','CC CO');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','CCBU','CC BU');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval,'OT_REC','TS','TELESALES');
--DBCGO_LOV - OT_SAP
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'CEVS', 'CEVS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'CNVS', 'CNVS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'LOVS', 'LOVS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'NEVS', 'NEVS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'NOVS', 'NOVS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'S1VS', 'S1VS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'S2VS', 'S2VS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'VEDG', 'VEDG');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'N8VS', 'N8VS');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'CUP', 'CUP');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'CCCO', 'CC CO');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'CCBU', 'CC BU');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'OT_SAP', 'TS', 'TELESALES');
--DBCGO_LOV - TIPO_CONTRATTO
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'TIPO_CONTRATTO', 'PRP', 'Prepagato');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'TIPO_CONTRATTO', 'POP', 'Abbonato');
--DBCGO_LOV - VALORE_CLIENTE
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_CLIENTE', 'BASSO', 'Basso');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_CLIENTE', 'MEDIO', 'Medio');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_CLIENTE', 'ALTO', 'Alto');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_CLIENTE', 'ND', 'Non Definito');
--DBCGO_LOV - VALORE_SPESA
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_SPESA', 'BASSO_SP', 'Basso Spendente');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_SPESA', 'MEDIO_SP', 'Medio Spendente');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_SPESA', 'ALTO_SP', 'Alto Spendente');
Insert into DBCGO_LOV(LOV_ID, LOV_NAME, NAME, DESCR) Values (SEQ_LOV.nextval, 'VALORE_SPESA', 'ND', 'Non Definito');
--DBCGO_LOV - OT_SAP --> OT_REC
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CEVS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CNVS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='LOVS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='NEVS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='NOVS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='S1VS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='S2VS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='VEDG';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='N8VS';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CUP';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CCCO';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CCBU';
insert into DBCGO_LOV_REF(lov_id, lov_id_ref) select lov_id,lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='TS';
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='C') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CEVS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='CN') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CNVS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='LO') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='LOVS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='NE') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='NEVS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='NO') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='NOVS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='S1') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='S1VS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='S2') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='S2VS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='VEDG') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='VEDG') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='N8VS') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='N8VS') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='CUP') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CUP') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='CCCO') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CCCO') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='CCBU') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='CCBU') ;
update DBCGO_LOV_REF set lov_id_ref = (select lov_id from DBCGO_LOV where lov_name='OT_REC' and name='TS') where lov_id=(select lov_id from DBCGO_LOV where lov_name='OT_SAP' and name='TS') ;
-------------------------------------------------------------------------
-------------------- INFASAMENTO PING PONG ------------------------------
---donor
insert into dbcgo_gestione_richiesta(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codicerifiutovalidazione, codice_operatore_recipient, msisdn,
codice_fiscale_partita_iva, codice_pre_post_pagato, nome_cliente,
cognome_cliente, ragione_sociale, richiestaadhocaom,
richiestaadhoc, marcaggio, sottomarcaggio, id_priorita,
insert_date, update_date, codice_gruppo, iccd_serial_number,
imsi, ipotesi_rifiuto, numero_documento, tipo_documento,
timestamp, data_transizione_stato, nome_ot_geo, nome_ot_leg,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_donating)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codicerifiutovalidazione, a.codice_operatore_recipient, a.msisdn,
a.codice_fiscale_partita_iva, a.codice_pre_post_pagato, a.nome_cliente,
a.cognome_cliente, a.ragione_sociale, a.richiestaadhocaom,
a.richiestaadhoc, a.marcaggio, a.sottomarcaggio, 0,
SYSDATE, SYSDATE, a.codice_gruppo, a.iccd_serial_number,
a.imsi, a.ipotesi_rifiuto, a.numero_documento, a.tipo_documento,
SYSTIMESTAMP, b.data_lavorazione, '', a.nome_ot,
0, b.data_lavorazione,
a.codice_operatore_donating
FROM mnp_gestione_richiesta@mnp a, mnp_storico_richiesta@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=16 and b.stato_a=16
and a.dataricezionerichiesta >= to_date('01-01-2004','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-06-2004','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-01-2004','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
insert into dbcgo_gestione_richiesta(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codicerifiutovalidazione, codice_operatore_recipient, msisdn,
codice_fiscale_partita_iva, codice_pre_post_pagato, nome_cliente,
cognome_cliente, ragione_sociale, richiestaadhocaom,
richiestaadhoc, marcaggio, sottomarcaggio, id_priorita,
insert_date, update_date, codice_gruppo, iccd_serial_number,
imsi, ipotesi_rifiuto, numero_documento, tipo_documento,
timestamp, data_transizione_stato, nome_ot_geo, nome_ot_leg,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_donating)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codicerifiutovalidazione, a.codice_operatore_recipient, a.msisdn,
a.codice_fiscale_partita_iva, a.codice_pre_post_pagato, a.nome_cliente,
a.cognome_cliente, a.ragione_sociale, a.richiestaadhocaom,
a.richiestaadhoc, a.marcaggio, a.sottomarcaggio, 0,
SYSDATE, SYSDATE, a.codice_gruppo, a.iccd_serial_number,
a.imsi, a.ipotesi_rifiuto, a.numero_documento, a.tipo_documento,
SYSTIMESTAMP, b.data_lavorazione, '', a.nome_ot,
0, b.data_lavorazione,
a.codice_operatore_donating
FROM mnp_gestione_richiesta@mnp a, mnp_storico_richiesta@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=16 and b.stato_a=16
and a.dataricezionerichiesta >= to_date('01-06-2004','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-01-2005','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-06-2004','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
insert into dbcgo_gestione_richiesta(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codicerifiutovalidazione, codice_operatore_recipient, msisdn,
codice_fiscale_partita_iva, codice_pre_post_pagato, nome_cliente,
cognome_cliente, ragione_sociale, richiestaadhocaom,
richiestaadhoc, marcaggio, sottomarcaggio, id_priorita,
insert_date, update_date, codice_gruppo, iccd_serial_number,
imsi, ipotesi_rifiuto, numero_documento, tipo_documento,
timestamp, data_transizione_stato, nome_ot_geo, nome_ot_leg,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_donating)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codicerifiutovalidazione, a.codice_operatore_recipient, a.msisdn,
a.codice_fiscale_partita_iva, a.codice_pre_post_pagato, a.nome_cliente,
a.cognome_cliente, a.ragione_sociale, a.richiestaadhocaom,
a.richiestaadhoc, a.marcaggio, a.sottomarcaggio, 0,
SYSDATE, SYSDATE, a.codice_gruppo, a.iccd_serial_number,
a.imsi, a.ipotesi_rifiuto, a.numero_documento, a.tipo_documento,
SYSTIMESTAMP, b.data_lavorazione, '', a.nome_ot,
0, b.data_lavorazione,
a.codice_operatore_donating
FROM mnp_gestione_richiesta@mnp a, mnp_storico_richiesta@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=16 and b.stato_a=16
and a.dataricezionerichiesta >= to_date('01-01-2005','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-06-2005','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-01-2005','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
insert into dbcgo_gestione_richiesta(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codicerifiutovalidazione, codice_operatore_recipient, msisdn,
codice_fiscale_partita_iva, codice_pre_post_pagato, nome_cliente,
cognome_cliente, ragione_sociale, richiestaadhocaom,
richiestaadhoc, marcaggio, sottomarcaggio, id_priorita,
insert_date, update_date, codice_gruppo, iccd_serial_number,
imsi, ipotesi_rifiuto, numero_documento, tipo_documento,
timestamp, data_transizione_stato, nome_ot_geo, nome_ot_leg,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_donating)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codicerifiutovalidazione, a.codice_operatore_recipient, a.msisdn,
a.codice_fiscale_partita_iva, a.codice_pre_post_pagato, a.nome_cliente,
a.cognome_cliente, a.ragione_sociale, a.richiestaadhocaom,
a.richiestaadhoc, a.marcaggio, a.sottomarcaggio, 0,
SYSDATE, SYSDATE, a.codice_gruppo, a.iccd_serial_number,
a.imsi, a.ipotesi_rifiuto, a.numero_documento, a.tipo_documento,
SYSTIMESTAMP, b.data_lavorazione, '', a.nome_ot,
0, b.data_lavorazione,
a.codice_operatore_donating
FROM mnp_gestione_richiesta@mnp a, mnp_storico_richiesta@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=16 and b.stato_a=16
and a.dataricezionerichiesta >= to_date('01-06-2005','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-01-2006','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-06-2005','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
------ recipient
insert into dbcgo_gestione_richiesta_rec(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, msisdn, codice_fiscale_partita_iva,
codice_pre_post_pagato, nome_cliente, cognome_cliente,
ragione_sociale, causale_accodamento, richiestaadhoc,
richiestaadhocaom, id_priorita, insert_date, update_date,
iccd_serial_number, imsi, nome_ot, numero_documento,
tipo_documento, numero_invii, timestamp, data_transizione_stato,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_recipient, codice_gruppo, codice_dealer,
valore_cliente, valore_spesa)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.msisdn, a.codice_fiscale_partita_iva,
a.codice_pre_post_pagato, a.nome_cliente, a.cognome_cliente,
a.ragione_sociale, a.causale_accodamento, a.richiestaadhoc,
a.richiestaadhocaom, 0, sysdate, sysdate,
a.iccid_serial_number, a.imsi, a.nome_ot, a.numero_documento,
a.tipo_documento, a.numero_invii, SYSTIMESTAMP, b.data_lavorazione,
0, b.data_lavorazione,
a.codice_operatore_recipient, a.codice_gruppo, '',
'ND', 'ND'
FROM mnp_gestione_richiesta_rec@mnp a,mnp_storico_richiesta_rec@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=12 and b.stato_a=12
and a.dataricezionerichiesta >= to_date('01-01-2004','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-06-2004','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-01-2004','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta_rec c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
insert into dbcgo_gestione_richiesta_rec(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, msisdn, codice_fiscale_partita_iva,
codice_pre_post_pagato, nome_cliente, cognome_cliente,
ragione_sociale, causale_accodamento, richiestaadhoc,
richiestaadhocaom, id_priorita, insert_date, update_date,
iccd_serial_number, imsi, nome_ot, numero_documento,
tipo_documento, numero_invii, timestamp, data_transizione_stato,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_recipient, codice_gruppo, codice_dealer,
valore_cliente, valore_spesa)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.msisdn, a.codice_fiscale_partita_iva,
a.codice_pre_post_pagato, a.nome_cliente, a.cognome_cliente,
a.ragione_sociale, a.causale_accodamento, a.richiestaadhoc,
a.richiestaadhocaom, 0, sysdate, sysdate,
a.iccid_serial_number, a.imsi, a.nome_ot, a.numero_documento,
a.tipo_documento, a.numero_invii, SYSTIMESTAMP, b.data_lavorazione,
0, b.data_lavorazione,
a.codice_operatore_recipient, a.codice_gruppo, '',
'ND', 'ND'
FROM mnp_gestione_richiesta_rec@mnp a,mnp_storico_richiesta_rec@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=12 and b.stato_a=12
and a.dataricezionerichiesta >= to_date('01-06-2004','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-01-2005','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-06-2004','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta_rec c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
insert into dbcgo_gestione_richiesta_rec(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, msisdn, codice_fiscale_partita_iva,
codice_pre_post_pagato, nome_cliente, cognome_cliente,
ragione_sociale, causale_accodamento, richiestaadhoc,
richiestaadhocaom, id_priorita, insert_date, update_date,
iccd_serial_number, imsi, nome_ot, numero_documento,
tipo_documento, numero_invii, timestamp, data_transizione_stato,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_recipient, codice_gruppo, codice_dealer,
valore_cliente, valore_spesa)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.msisdn, a.codice_fiscale_partita_iva,
a.codice_pre_post_pagato, a.nome_cliente, a.cognome_cliente,
a.ragione_sociale, a.causale_accodamento, a.richiestaadhoc,
a.richiestaadhocaom, 0, sysdate, sysdate,
a.iccid_serial_number, a.imsi, a.nome_ot, a.numero_documento,
a.tipo_documento, a.numero_invii, SYSTIMESTAMP, b.data_lavorazione,
0, b.data_lavorazione,
a.codice_operatore_recipient, a.codice_gruppo, '',
'ND', 'ND'
FROM mnp_gestione_richiesta_rec@mnp a,mnp_storico_richiesta_rec@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=12 and b.stato_a=12
and a.dataricezionerichiesta >= to_date('01-01-2005','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-06-2005','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-01-2005','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta_rec c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
insert into dbcgo_gestione_richiesta_rec(
id_richiesta, stato, tipo_cliente, data_cut_over_calc,
data_validazione_max, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, msisdn, codice_fiscale_partita_iva,
codice_pre_post_pagato, nome_cliente, cognome_cliente,
ragione_sociale, causale_accodamento, richiestaadhoc,
richiestaadhocaom, id_priorita, insert_date, update_date,
iccd_serial_number, imsi, nome_ot, numero_documento,
tipo_documento, numero_invii, timestamp, data_transizione_stato,
id_priorita_mnp, data_transizione_stato_grp,
codice_operatore_recipient, codice_gruppo, codice_dealer,
valore_cliente, valore_spesa)
SELECT a.id_richiesta, a.stato, a.tipo_cliente, a.data_cut_over_calc,
a.data_validazione_max, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.msisdn, a.codice_fiscale_partita_iva,
a.codice_pre_post_pagato, a.nome_cliente, a.cognome_cliente,
a.ragione_sociale, a.causale_accodamento, a.richiestaadhoc,
a.richiestaadhocaom, 0, sysdate, sysdate,
a.iccid_serial_number, a.imsi, a.nome_ot, a.numero_documento,
a.tipo_documento, a.numero_invii, SYSTIMESTAMP, b.data_lavorazione,
0, b.data_lavorazione,
a.codice_operatore_recipient, a.codice_gruppo, '',
'ND', 'ND'
FROM mnp_gestione_richiesta_rec@mnp a,mnp_storico_richiesta_rec@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=12 and b.stato_a=12
and a.dataricezionerichiesta >= to_date('01-06-2005','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-01-2006','dd-mm-yyyy')
and a.data_cut_over_calc >= to_date('01-06-2005','dd-mm-yyyy')
and a.id_richiesta not in (
select id_richiesta
from dbcgo_gestione_richiesta_rec c
where c.id_richiesta=a.id_richiesta
)
/
commit
/
------ porting
insert into dbcgo_gestione_richiesta_por(
id_richiesta, stato, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, codice_operatore_recipient, msisdn,
insert_date, update_date, timestamp, data_transizione_stato)
SELECT a.id_richiesta, a.stato, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.codice_operatore_recipient, a.msisdn,
sysdate, sysdate, SYSTIMESTAMP, b.data_lavorazione
FROM mnp_gestione_richiesta_porting@mnp a,mnp_storico_porting@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=6 and b.stato_a=6
and a.dataricezionerichiesta >= to_date('01-01-2004','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-06-2004','dd-mm-yyyy')
/
commit
/
insert into dbcgo_gestione_richiesta_por(
id_richiesta, stato, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, codice_operatore_recipient, msisdn,
insert_date, update_date, timestamp, data_transizione_stato)
SELECT a.id_richiesta, a.stato, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.codice_operatore_recipient, a.msisdn,
sysdate, sysdate, SYSTIMESTAMP, b.data_lavorazione
FROM mnp_gestione_richiesta_porting@mnp a,mnp_storico_porting@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=6 and b.stato_a=6
and a.dataricezionerichiesta >= to_date('01-06-2004','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-01-2005','dd-mm-yyyy')
/
commit
/
insert into dbcgo_gestione_richiesta_por(
id_richiesta, stato, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, codice_operatore_recipient, msisdn,
insert_date, update_date, timestamp, data_transizione_stato)
SELECT a.id_richiesta, a.stato, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.codice_operatore_recipient, a.msisdn,
sysdate, sysdate, SYSTIMESTAMP, b.data_lavorazione
FROM mnp_gestione_richiesta_porting@mnp a,mnp_storico_porting@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=6 and b.stato_a=6
and a.dataricezionerichiesta >= to_date('01-01-2005','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-06-2005','dd-mm-yyyy')
/
commit
/
insert into dbcgo_gestione_richiesta_por(
id_richiesta, stato, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, codice_operatore_recipient, msisdn,
insert_date, update_date, timestamp, data_transizione_stato)
SELECT a.id_richiesta, a.stato, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.codice_operatore_recipient, a.msisdn,
sysdate, sysdate, SYSTIMESTAMP, b.data_lavorazione
FROM mnp_gestione_richiesta_porting@mnp a,mnp_storico_porting@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=6 and b.stato_a=6
and a.dataricezionerichiesta >= to_date('01-06-2005','dd-mm-yyyy')
and a.dataricezionerichiesta < to_date('01-01-2006','dd-mm-yyyy')
/
commit
/
insert into dbcgo_gestione_richiesta_por(
id_richiesta, stato, dataricezionerichiesta, data_cut_over,
codice_operatore_donating, codice_operatore_recipient, msisdn,
insert_date, update_date, timestamp, data_transizione_stato)
SELECT a.id_richiesta, a.stato, a.dataricezionerichiesta, a.data_cut_over,
a.codice_operatore_donating, a.codice_operatore_recipient, a.msisdn,
sysdate, sysdate, SYSTIMESTAMP, b.data_lavorazione
FROM mnp_gestione_richiesta_porting@mnp a,mnp_storico_porting@mnp b
where a.id_richiesta=b.id_richiesta
and a.stato=6 and b.stato_a=6
and a.dataricezionerichiesta >= to_date('01-01-2006','dd-mm-yyyy')
/
update dbcgo_gestione_richiesta
set nome_ot_leg='NN',nome_ot_geo='NN',marcaggio='01',sottomarcaggio='34'
where tipo_cliente='CO' and nome_ot_leg='ZZ'
/
commit;
-------------------------------------------------------------------------