First Commit - Source Code from Reply
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select id_richiesta || ';' || msisdn || ';' || descr_stato ||';'
|
||||
from mnp_gestione_richiesta, mnp_stato st
|
||||
where data_validazione_max <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
AND tipo_cliente='BU'
|
||||
AND stato in (6)
|
||||
AND stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'BIT_DBC_VALIDAZIONEGIORNALIERE_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta;Msisdn;Stato Richiesta;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,59 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select id_richiesta || ';' || msisdn || ';' || descr_stato || ';' || data_validazione_max || ';'
|
||||
from mnp_gestione_richiesta, mnp_stato st
|
||||
where data_validazione_max <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and data_validazione_max >= decode(df,'nullo',data_validazione_max,to_date(df,'dd-MON-yy'))
|
||||
AND tipo_cliente='BU'
|
||||
AND stato in (6)
|
||||
AND stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'BIT_DBC_VALIDAZIONERITARDO_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta;Msisdn;Stato Richiesta;Data validazione Max;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,77 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select id_richiesta || ';' || msisdn || ';' || descr_stato || ';'
|
||||
from mnp_gestione_richiesta, mnp_stato st
|
||||
where data_validazione_max <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
AND tipo_cliente='CO'
|
||||
AND stato in (6)
|
||||
AND stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
file1 := UTL_FILE.fopen (dir_out, 'CCRM_DBC_VALIDAZIONEGIORNALIERE_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta;Msisdn;Stato Richiesta;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
|
||||
set echo off
|
||||
|
||||
set head off
|
||||
set pagesize 0
|
||||
set feedback off
|
||||
set linesize 300
|
||||
set termout off
|
||||
|
||||
|
||||
select ' Codice Richiesta; MSISDN richiesta ; Stato Richiesta '
|
||||
from DUAL;
|
||||
|
||||
select id_richiesta || ';' || msisdn || ';' || descr_stato
|
||||
from mnp_gestione_richiesta, mnp_stato st
|
||||
where trunc(data_validazione_max) = trunc(Sysdate)
|
||||
AND tipo_cliente='CO'
|
||||
AND stato in (6)
|
||||
AND stato = st.id_stato
|
||||
|
||||
set termout on
|
||||
|
||||
exit
|
||||
@@ -0,0 +1,62 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select id_richiesta || ';' || msisdn || ';' || descr_stato || ';' || data_validazione_max || ';'
|
||||
from mnp_gestione_richiesta, mnp_stato st
|
||||
where data_validazione_max <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and data_validazione_max >= decode(df,'nullo',data_validazione_max,to_date(df,'dd-MON-yy'))
|
||||
-- trunc(data_validazione_max) < trunc(Sysdate)
|
||||
AND tipo_cliente='CO'
|
||||
AND stato in (6)
|
||||
AND st.id_stato = stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'CCRM_DBC_VALIDAZIONERITARDO_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta;Msisdn;Stato Richiesta;Data validazione Max;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,59 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select r.id_richiesta || ';' || r.msisdn || ';' || r.codice_operatore_recipient || ';' || st.descr_stato || ';' || s1.data_i_o || ';' || s2.data_i_o || ';' || r.data_cut_over_calc || ';' || r.nome_ot ||';'
|
||||
from mnp_gestione_richiesta r, mnp_storico_richiesta s1, mnp_storico_richiesta s2, mnp_stato st
|
||||
where data_cut_over_calc <= decode(di,'nullo',trunc(sysdate+1),to_date(di,'dd-MON-yy'))
|
||||
AND stato in (7,9,14)
|
||||
AND tipo_cliente = 'BU'
|
||||
AND codice_pre_post_pagato = 'POP'
|
||||
AND r.id_richiesta = s1.id_richiesta
|
||||
AND s1.stato_da=1 AND s1.stato_a=3
|
||||
AND r.id_richiesta = s2.id_richiesta
|
||||
AND s2.stato_da=6 AND s2.stato_a=7
|
||||
AND r.stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
file1 := UTL_FILE.fopen (dir_out, 'DBC_CESSAZIONE_BUSINESS_POST_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice Richiesta; MSISDN richiesta ; Codice Operatore Recipient ; Stato Richiesta ; Data Presa in Carico ; Data Validazione effettiva ; Data Cut-Over Calcolata ; OT di appartenenza;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,60 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select r.id_richiesta || ';' || r.msisdn || ';' || r.codice_operatore_recipient || ';' || st.descr_stato || ';' || s1.data_i_o || ';' || s2.data_i_o || ';' || r.data_cut_over_calc || ';' || r.nome_ot ||';'
|
||||
from mnp_gestione_richiesta r, mnp_storico_richiesta s1, mnp_storico_richiesta s2, mnp_stato st
|
||||
where data_cut_over_calc <= decode(di,'nullo',trunc(sysdate+1),to_date(di,'dd-MON-yy'))
|
||||
AND stato in (7,9,14)
|
||||
AND tipo_cliente = 'BU'
|
||||
AND codice_pre_post_pagato = 'PRP'
|
||||
AND r.id_richiesta = s1.id_richiesta
|
||||
AND s1.stato_da=1 AND s1.stato_a=3
|
||||
AND r.id_richiesta = s2.id_richiesta
|
||||
AND s2.stato_da=6 AND s2.stato_a=7
|
||||
AND r.stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'DBC_CESSAZIONE_BUSINESS_PRE_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice Richiesta; MSISDN richiesta ; Codice Operatore Recipient ; Stato Richiesta ; Data Presa in Carico ; Data Validazione effettiva ; Data Cut-Over Calcolata ; OT di appartenenza;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,60 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select r.id_richiesta || ';' || r.msisdn || ';' || r.codice_operatore_recipient || ';' || st.descr_stato || ';' || s1.data_i_o || ';' || s2.data_i_o || ';' || r.data_cut_over_calc ||';'
|
||||
from mnp_gestione_richiesta r, mnp_storico_richiesta s1, mnp_storico_richiesta s2, mnp_stato st
|
||||
where data_cut_over_calc <= decode(di,'nullo',trunc(sysdate+1),to_date(di,'dd-MON-yy'))
|
||||
AND stato in (7,9,14)
|
||||
AND tipo_cliente = 'CO'
|
||||
AND codice_pre_post_pagato = 'POP'
|
||||
AND r.id_richiesta = s1.id_richiesta
|
||||
AND s1.stato_da=1 AND s1.stato_a=3
|
||||
AND r.id_richiesta = s2.id_richiesta
|
||||
AND s2.stato_da=6 AND s2.stato_a=7
|
||||
AND r.stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'DBC_CESSAZIONE_CONSUMER_POST_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice Richiesta; MSISDN richiesta ; Codice Operatore Recipient ; Stato Richiesta ; Data Presa in Carico ; Data Validazione effettiva ; Data Cut-Over Calcolata;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,61 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select r.id_richiesta || ';' || r.msisdn || ';' || r.codice_operatore_recipient || ';' || st.descr_stato || ';' || s1.data_lavorazione || ';' || s2.data_lavorazione || ';' || r.data_cut_over_calc ||';'
|
||||
from mnp_gestione_richiesta r, mnp_storico_richiesta s1, mnp_storico_richiesta s2, mnp_stato st
|
||||
where data_cut_over_calc <= decode(di,'nullo',trunc(sysdate+1),to_date(di,'dd-MON-yy'))
|
||||
AND stato in (7,9,14)
|
||||
AND tipo_cliente = 'CO'
|
||||
AND codice_pre_post_pagato = 'PRP'
|
||||
AND r.id_richiesta = s1.id_richiesta
|
||||
AND s1.stato_da=1 AND s1.stato_a=3
|
||||
AND r.id_richiesta = s2.id_richiesta
|
||||
AND s2.stato_da=6 AND s2.stato_a=7
|
||||
AND r.stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'DBC_CESSAZIONE_CONSUMER_PRE_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice Richiesta; MSISDN richiesta ; Codice Operatore Recipient ; Stato Richiesta ; Data Presa in Carico ; Data Validazione effettiva ; Data Cut-Over Calcolata;');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,56 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select id_richiesta || ';' || msisdn || ';' || descr_stato || ';' || data_cut_over_calc ||';'
|
||||
from mnp_gestione_richiesta, mnp_stato st
|
||||
where data_cut_over_calc <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and data_cut_over_calc >= decode(df,'nullo',data_cut_over_calc,to_date(df,'dd-MON-yy'))
|
||||
AND stato in (14)
|
||||
AND stato = st.id_stato;
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'MSS_DBC_CESSAZIONEINRITARDO_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta;Msisdn;Stato Richiesta;Data Cut-Over Calcolata;');
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO rs;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
115
dbcmnpsrc/FE/mnpapp/script/report/sql/MNP_SC_CESS.sql
Normal file
115
dbcmnpsrc/FE/mnpapp/script/report/sql/MNP_SC_CESS.sql
Normal file
@@ -0,0 +1,115 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs varchar2(255);
|
||||
nomefile VARCHAR2(255);
|
||||
operatrec VARCHAR2(255);
|
||||
errmsg VARCHAR2(255);
|
||||
idrichiesta VARCHAR2(255);
|
||||
msisdn_ VARCHAR2(255);
|
||||
conta integer(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_rec_ack_ko is
|
||||
select xo.nome_file , gr.codice_operatore_recipient , xai.err_msg , xro.id_richiesta ,gr.msisdn
|
||||
from mnp_xml_out xo,
|
||||
mnp_gestione_richiesta gr,
|
||||
mnp_xml_richiesta_out xro,
|
||||
mnp_xml_ack_in xai,
|
||||
mnp_xml_in xi
|
||||
where xo.nome_file = xai.nome_file_riferito
|
||||
and xo.nome_file = xro.nome_file
|
||||
and xro.id_richiesta = gr.id_richiesta
|
||||
and xo.tipo_file = 6
|
||||
and xai.risultato = 'ERROR'
|
||||
and xi.nome_file = xai.nome_file
|
||||
and xi.tipo_file = 8
|
||||
--and trunc(xi.data_eff) <= trunc(sysdate);
|
||||
and trunc(xi.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(xi.data_eff) >= decode(df,'nullo',trunc(xi.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
CURSOR cur_rec_noack is
|
||||
select xo.nome_file ,gr.codice_operatore_recipient , null ,xro.id_richiesta , gr.msisdn
|
||||
from mnp_xml_out xo,
|
||||
mnp_gestione_richiesta gr,
|
||||
mnp_xml_richiesta_out xro
|
||||
where xo.da_inviare = 2
|
||||
and xo.tipo_file = 6
|
||||
and xo.nome_file = xro.nome_file
|
||||
and xro.id_richiesta = gr.id_richiesta;
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
--DBMS_OUTPUT.PUT_LINE('i parametri sono di input ....' || di || '...df...' || df );
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'DONOR_TIM_ACKKOESPLETAMENTO_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Nome file Espletamento; Codice operatore; Messaggio Errore; Codice richiesta; MSISDN;');
|
||||
|
||||
conta:=0;
|
||||
OPEN cur_rec_ack_ko;
|
||||
LOOP
|
||||
FETCH cur_rec_ack_ko INTO nomefile,operatrec,errmsg,idrichiesta,msisdn_;
|
||||
EXIT when cur_rec_ack_ko%NOTFOUND;
|
||||
|
||||
select count(nome_file_riferito) into conta
|
||||
from mnp_xml_ack_in
|
||||
where nome_file_riferito = nomefile
|
||||
and risultato != 'ERROR';
|
||||
|
||||
if (conta = 0)then
|
||||
UTL_FILE.put_line(file1,nomefile || ';' || operatrec || ';' || errmsg || ';' || idrichiesta ||';' || msisdn_ || ';');
|
||||
else
|
||||
conta := 0;
|
||||
end if;
|
||||
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_rec_ack_ko;
|
||||
|
||||
nomefile :='';
|
||||
operatrec :='';
|
||||
errmsg :='';
|
||||
idrichiesta :='';
|
||||
msisdn_ :='';
|
||||
|
||||
|
||||
open cur_rec_noack;
|
||||
LOOP
|
||||
FETCH cur_rec_noack INTO nomefile,operatrec,errmsg,idrichiesta,msisdn_;
|
||||
EXIT WHEN cur_rec_noack%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,nomefile || ';' || operatrec || ';' || errmsg || ';' || idrichiesta ||';' || msisdn_ || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_rec_noack;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
122
dbcmnpsrc/FE/mnpapp/script/report/sql/MNP_SC_PIC.sql
Normal file
122
dbcmnpsrc/FE/mnpapp/script/report/sql/MNP_SC_PIC.sql
Normal file
@@ -0,0 +1,122 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(255);
|
||||
nomefile VARCHAR2(255);
|
||||
operatrec VARCHAR2(255);
|
||||
errmsg VARCHAR2(255);
|
||||
pippo varchar2(255):='&1';
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
idrichiesta VARCHAR2(255);
|
||||
msisdn_ VARCHAR2(255);
|
||||
conta integer(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
|
||||
|
||||
|
||||
CURSOR cur_rec_ack_ko is
|
||||
select distinct xo.nome_file , gr.codice_operatore_recipient , xai.err_msg , xro.id_richiesta , gr.msisdn
|
||||
from mnp_xml_out xo,
|
||||
mnp_xml_in xi,
|
||||
mnp_gestione_richiesta gr,
|
||||
mnp_xml_richiesta_out xro,
|
||||
mnp_xml_ack_in xai
|
||||
where xo.nome_file = xai.nome_file_riferito
|
||||
and xo.nome_file = xro.nome_file
|
||||
and xro.id_richiesta = gr.id_richiesta
|
||||
and xo.tipo_file = 5
|
||||
and xai.risultato = 'ERROR'
|
||||
and xi.nome_file = xai.nome_file
|
||||
and xi.tipo_file = 8
|
||||
-- and trunc(xi.data_eff) <= trunc(sysdate);
|
||||
and trunc(xi.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(xi.data_eff) >= decode(df,'nullo',trunc(xi.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
|
||||
|
||||
CURSOR cur_rec_noack is
|
||||
select distinct xo.nome_file , gr.codice_operatore_recipient , null , xro.id_richiesta , gr.msisdn
|
||||
from mnp_xml_out xo,
|
||||
mnp_gestione_richiesta gr,
|
||||
mnp_xml_richiesta_out xro
|
||||
where xo.da_inviare = 2
|
||||
and xo.tipo_file = 5
|
||||
and xo.nome_file = xro.nome_file
|
||||
and xro.id_richiesta = gr.id_richiesta;
|
||||
BEGIN
|
||||
|
||||
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
--DBMS_OUTPUT.PUT_LINE('i parametri sono di input ....' || di || '...df...' || df );
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen(dir_out,'DONOR_TIM_ACKKOPRESAINCARICO_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Nome file; Codice operatore Recipient; Messaggio di errore; Codice delle richieste; MSISDN;');
|
||||
conta:=0;
|
||||
OPEN cur_rec_ack_ko;
|
||||
LOOP
|
||||
FETCH cur_rec_ack_ko INTO nomefile,operatrec,errmsg,idrichiesta,msisdn_;
|
||||
EXIT when cur_rec_ack_ko%NOTFOUND;
|
||||
|
||||
select count(nome_file_riferito) into conta
|
||||
from mnp_xml_ack_in
|
||||
where nome_file_riferito = nomefile
|
||||
and risultato != 'ERROR';
|
||||
|
||||
if (conta = 0)then
|
||||
UTL_FILE.put_line(file1,nomefile || ';' || operatrec || ';' || errmsg || ';' || idrichiesta ||';' || msisdn_ || ';');
|
||||
else
|
||||
conta := 0;
|
||||
end if;
|
||||
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_rec_ack_ko;
|
||||
|
||||
nomefile :='';
|
||||
operatrec :='';
|
||||
errmsg :='';
|
||||
idrichiesta :='';
|
||||
msisdn_ :='';
|
||||
|
||||
|
||||
open cur_rec_noack;
|
||||
LOOP
|
||||
FETCH cur_rec_noack INTO nomefile,operatrec,errmsg,idrichiesta,msisdn_;
|
||||
EXIT WHEN cur_rec_noack%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,nomefile || ';' || operatrec || ';' || errmsg || ';' || idrichiesta ||';' || msisdn_ || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_rec_noack;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
112
dbcmnpsrc/FE/mnpapp/script/report/sql/MNP_SC_VAL.sql
Normal file
112
dbcmnpsrc/FE/mnpapp/script/report/sql/MNP_SC_VAL.sql
Normal file
@@ -0,0 +1,112 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(255);
|
||||
nomefile VARCHAR2(255);
|
||||
operatrec VARCHAR2(255);
|
||||
errmsg VARCHAR2(255);
|
||||
idrichiesta VARCHAR2(255);
|
||||
msisdn_ VARCHAR2(255);
|
||||
conta integer(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_rec_ack_ko is
|
||||
select distinct xo.nome_file , gr.codice_operatore_recipient , xai.err_msg ,xro.id_richiesta , gr.msisdn
|
||||
from mnp_xml_out xo,
|
||||
mnp_gestione_richiesta gr,
|
||||
mnp_xml_richiesta_out xro,
|
||||
mnp_xml_ack_in xai,
|
||||
mnp_xml_in xi
|
||||
where xo.nome_file = xai.nome_file_riferito
|
||||
and xo.nome_file = xro.nome_file
|
||||
and xro.id_richiesta = gr.id_richiesta
|
||||
and xo.tipo_file = 2
|
||||
and xai.risultato = 'ERROR'
|
||||
and xi.nome_file = xai.nome_file
|
||||
and xi.tipo_file = 8
|
||||
and trunc(xi.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(xi.data_eff) >= decode(df,'nullo',trunc(xi.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
CURSOR cur_rec_noack is
|
||||
select distinct xo.nome_file , gr.codice_operatore_recipient , null , xro.id_richiesta , gr.msisdn
|
||||
from mnp_xml_out xo,
|
||||
mnp_gestione_richiesta gr,
|
||||
mnp_xml_richiesta_out xro
|
||||
where xo.da_inviare= 2
|
||||
and xo.tipo_file = 2
|
||||
and xo.nome_file = xro.nome_file
|
||||
and xro.id_richiesta = gr.id_richiesta;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'DONOR_TIM_ACKKOVALIDAZIONE_' || to_char(sysdate,'yyyyMMdd') ||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Nome file Validazione; Codice Operatore; Messaggio di errore; Codice Richiesta; MSISDN;');
|
||||
|
||||
conta:=0;
|
||||
OPEN cur_rec_ack_ko;
|
||||
LOOP
|
||||
FETCH cur_rec_ack_ko INTO nomefile,operatrec,errmsg,idrichiesta,msisdn_;
|
||||
EXIT when cur_rec_ack_ko%NOTFOUND;
|
||||
|
||||
select count(nome_file_riferito) into conta
|
||||
from mnp_xml_ack_in
|
||||
where nome_file_riferito = nomefile
|
||||
and risultato != 'ERROR';
|
||||
|
||||
if (conta = 0)then
|
||||
UTL_FILE.put_line(file1,nomefile || ';' || operatrec || ';' || errmsg || ';' || idrichiesta ||';' || msisdn_ || ';');
|
||||
else
|
||||
conta := 0;
|
||||
end if;
|
||||
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_rec_ack_ko;
|
||||
|
||||
nomefile :='';
|
||||
operatrec :='';
|
||||
errmsg :='';
|
||||
idrichiesta :='';
|
||||
msisdn_ :='';
|
||||
|
||||
|
||||
open cur_rec_noack;
|
||||
LOOP
|
||||
FETCH cur_rec_noack INTO nomefile,operatrec,errmsg,idrichiesta,msisdn_;
|
||||
EXIT WHEN cur_rec_noack%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,nomefile || ';' || operatrec || ';' || errmsg || ';' || idrichiesta ||';' || msisdn_ || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_rec_noack;
|
||||
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
|
||||
exception
|
||||
WHEN others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,222 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs1 VARCHAR2 (255);
|
||||
rs2 VARCHAR2 (255);
|
||||
operatore VARCHAR2 (15);
|
||||
operatore_res VARCHAR2 (15);
|
||||
operatore_ VARCHAR2 (15);
|
||||
dir_out VARCHAR2 (255);
|
||||
num NUMBER (15, 0);
|
||||
totale NUMBER (15, 0);
|
||||
cod_ope VARCHAR2 (15);
|
||||
cod VARCHAR2 (4);
|
||||
file1 UTL_FILE.file_type;
|
||||
data_inizio DATE;
|
||||
data_fine DATE;
|
||||
DATA DATE;
|
||||
di DATE;
|
||||
p VARCHAR2 (15) := '&1';
|
||||
cod_olo NUMBER (5);
|
||||
|
||||
--cursore degli operatori
|
||||
CURSOR cur_operatori
|
||||
IS
|
||||
SELECT desc_olo, cod_olo
|
||||
FROM mnp_olo_report
|
||||
WHERE flag_attivo = 1 AND desc_olo NOT IN ('TIMT', 'TIMG')
|
||||
ORDER BY desc_olo;
|
||||
|
||||
--Numero di attivazioni non effettuate da un operatore in qualita di terza parte
|
||||
CURSOR cur_res (
|
||||
data_inizio DATE,
|
||||
data_fine DATE,
|
||||
cod_olo NUMBER,
|
||||
operatore VARCHAR2
|
||||
)
|
||||
IS
|
||||
SELECT olo.desc_olo, NVL (SUM (x.num), 0)
|
||||
FROM mnp_olo_report olo,
|
||||
(SELECT COUNT (r.id_richiesta) num,
|
||||
codice_operatore_donating cod
|
||||
FROM mnp_gestione_richiesta_rec r
|
||||
WHERE r.data_cut_over_calc >= TRUNC (data_inizio)
|
||||
AND r.data_cut_over_calc <= TRUNC (data_fine)
|
||||
AND r.espletamentoterzeparti LIKE '%' || cod_olo || '%'
|
||||
AND r.codice_operatore_donating != operatore
|
||||
AND r.codice_operatore_donating = 'TIMT'
|
||||
AND r.stato IN (8, 10, 11)
|
||||
GROUP BY codice_operatore_donating
|
||||
UNION ALL
|
||||
SELECT COUNT (r.id_richiesta) num,
|
||||
codice_operatore_donating cod
|
||||
FROM mnp_gestione_richiesta_rec r
|
||||
WHERE r.data_cut_over_aom >= TRUNC (data_inizio)
|
||||
AND r.data_cut_over_aom <= TRUNC (data_fine)
|
||||
AND r.espletamentoterzeparti LIKE '%' || cod_olo || '%'
|
||||
AND r.codice_operatore_donating != operatore
|
||||
AND r.codice_operatore_donating != 'TIMT'
|
||||
AND r.stato IN (8, 10, 11)
|
||||
GROUP BY codice_operatore_donating
|
||||
UNION ALL
|
||||
SELECT COUNT (r.id_richiesta) num,
|
||||
codice_operatore_donating cod
|
||||
FROM mnp_gestione_richiesta_rec r
|
||||
WHERE r.data_cut_over_calc >= TRUNC (data_inizio)
|
||||
AND r.data_cut_over_calc <= TRUNC (data_fine)
|
||||
AND r.codice_operatore_donating != operatore
|
||||
AND r.codice_operatore_donating = 'TIMT'
|
||||
AND r.stato IN (8, 10, 11, 12)
|
||||
AND EXISTS (
|
||||
SELECT xri.id_richiesta
|
||||
FROM mnp_xml_in xi, mnp_xml_richiesta_in xri
|
||||
WHERE xi.tipo_file = 6
|
||||
AND xi.mittente = operatore
|
||||
AND xi.nome_file = xri.nome_file
|
||||
AND xri.id_richiesta = r.id_richiesta
|
||||
AND xri.richiestaxml LIKE
|
||||
'%<STATO_RICHIESTA_NOTIFICA>4%'
|
||||
AND TRUNC (xi.data_eff) > r.data_cut_over_calc
|
||||
MINUS
|
||||
SELECT xri.id_richiesta
|
||||
FROM mnp_xml_in xi, mnp_xml_richiesta_in xri
|
||||
WHERE xi.tipo_file = 6
|
||||
AND xi.mittente = operatore
|
||||
AND xi.nome_file = xri.nome_file
|
||||
AND xri.id_richiesta = r.id_richiesta
|
||||
AND xri.richiestaxml LIKE
|
||||
'%<STATO_RICHIESTA_NOTIFICA>4%'
|
||||
AND TRUNC (xi.data_eff) <= r.data_cut_over_calc)
|
||||
GROUP BY codice_operatore_donating
|
||||
UNION ALL
|
||||
SELECT COUNT (r.id_richiesta) num,
|
||||
codice_operatore_donating cod
|
||||
FROM mnp_gestione_richiesta_rec r
|
||||
WHERE r.data_cut_over_aom >= TRUNC (data_inizio)
|
||||
AND r.data_cut_over_aom <= TRUNC (data_fine)
|
||||
AND r.codice_operatore_donating != operatore
|
||||
AND r.codice_operatore_donating != 'TIMT'
|
||||
AND r.stato IN (8, 10, 11, 12)
|
||||
AND EXISTS (
|
||||
SELECT xri.id_richiesta
|
||||
FROM mnp_xml_in xi, mnp_xml_richiesta_in xri
|
||||
WHERE xi.tipo_file = 6
|
||||
AND xi.mittente = operatore
|
||||
AND xi.nome_file = xri.nome_file
|
||||
AND xri.id_richiesta = r.id_richiesta
|
||||
AND xri.richiestaxml LIKE
|
||||
'%<STATO_RICHIESTA_NOTIFICA>4%'
|
||||
AND TRUNC (xi.data_eff) > r.data_cut_over_aom
|
||||
MINUS
|
||||
SELECT xri.id_richiesta
|
||||
FROM mnp_xml_in xi, mnp_xml_richiesta_in xri
|
||||
WHERE xi.tipo_file = 6
|
||||
AND xi.mittente = operatore
|
||||
AND xi.nome_file = xri.nome_file
|
||||
AND xri.id_richiesta = r.id_richiesta
|
||||
AND xri.richiestaxml LIKE
|
||||
'%<STATO_RICHIESTA_NOTIFICA>4%'
|
||||
AND TRUNC (xi.data_eff) <= r.data_cut_over_aom)
|
||||
GROUP BY codice_operatore_donating) x
|
||||
WHERE olo.flag_attivo = 1 AND olo.desc_olo = x.cod(+)
|
||||
GROUP BY olo.desc_olo
|
||||
ORDER BY desc_olo;
|
||||
--INIZIO
|
||||
BEGIN
|
||||
IF (p <> 'nullo')
|
||||
THEN
|
||||
data_inizio := TO_DATE ('&1', 'dd/mm/yyyy');
|
||||
data_fine := TO_DATE ('&2', 'dd/mm/yyyy');
|
||||
dir_out := '&3';
|
||||
ELSE
|
||||
IF (TO_CHAR (SYSDATE, 'DD') <= '15')
|
||||
THEN
|
||||
DATA := ADD_MONTHS ((TRUNC (SYSDATE)), -1);
|
||||
data_inizio :=
|
||||
TO_DATE ('16/' || TO_CHAR (TRUNC (DATA), 'mm/yyyy'),
|
||||
'dd/mm/yyyy');
|
||||
data_fine := LAST_DAY (TRUNC (DATA));
|
||||
ELSE
|
||||
data_inizio :=
|
||||
TO_DATE ('01/' || TO_CHAR (TRUNC (SYSDATE), 'mm/yyyy'),
|
||||
'dd/mm/yyyy'
|
||||
);
|
||||
data_fine :=
|
||||
TO_DATE ('15/' || TO_CHAR (TRUNC (SYSDATE), 'mm/yyyy'),
|
||||
'dd/mm/yyyy'
|
||||
);
|
||||
END IF;
|
||||
|
||||
SELECT donor_out
|
||||
INTO dir_out
|
||||
FROM mnp_olo_report
|
||||
WHERE desc_olo = 'MONIT';
|
||||
END IF;
|
||||
|
||||
BEGIN
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori
|
||||
INTO operatore, cod_olo;
|
||||
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
totale := 0;
|
||||
file1 :=
|
||||
UTL_FILE.fopen (dir_out,
|
||||
'TIMG_to_'
|
||||
|| UPPER (operatore)
|
||||
|| '_AttivazioneNonEffet_'
|
||||
|| TO_CHAR (SYSDATE, 'yyyyMMdd')
|
||||
|| '.csv',
|
||||
'w'
|
||||
);
|
||||
UTL_FILE.put_line
|
||||
(file1,
|
||||
'Numero di attivazioni non effettuate da '
|
||||
|| UPPER (operatore)
|
||||
|| ' in qualità di operatore terza parte il giorno di cut_over previsto'
|
||||
);
|
||||
UTL_FILE.put_line (file1, ' ');
|
||||
UTL_FILE.put_line (file1,
|
||||
'Periodo dal '
|
||||
|| TRUNC (data_inizio)
|
||||
|| ' al '
|
||||
|| TRUNC (data_fine)
|
||||
);
|
||||
UTL_FILE.put_line (file1, ' ');
|
||||
UTL_FILE.put_line (file1,
|
||||
'Operatore OLO terza Parte: ' || UPPER (operatore)
|
||||
);
|
||||
UTL_FILE.put_line (file1, ' ');
|
||||
UTL_FILE.put_line (file1, ';TIMG ');
|
||||
|
||||
OPEN cur_res (data_inizio, data_fine, cod_olo, operatore);
|
||||
|
||||
LOOP
|
||||
FETCH cur_res
|
||||
INTO operatore_, num;
|
||||
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
UTL_FILE.put_line (file1, operatore_ || ';' || num);
|
||||
totale := totale + num;
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_res;
|
||||
|
||||
UTL_FILE.put_line (file1, 'Totale' || ';' || totale);
|
||||
END LOOP;
|
||||
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
|
||||
CLOSE cur_operatori;
|
||||
EXCEPTION
|
||||
WHEN OTHERS
|
||||
THEN
|
||||
DBMS_OUTPUT.put_line (SQLERRM);
|
||||
END;
|
||||
END;
|
||||
/
|
||||
|
||||
EXIT;
|
||||
411
dbcmnpsrc/FE/mnpapp/script/report/sql/NumeroLineePortate.sql
Normal file
411
dbcmnpsrc/FE/mnpapp/script/report/sql/NumeroLineePortate.sql
Normal file
@@ -0,0 +1,411 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs1 varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
operatore varchar2(15);
|
||||
ope_don varchar2(15);
|
||||
dir_out varchar2(255);
|
||||
num NUMBER(15,0):=0;
|
||||
totale NUMBER(15,0):=0;
|
||||
file1 UTL_FILE.file_type;
|
||||
data_inizio date;
|
||||
data_fine date;
|
||||
data date;
|
||||
di date;
|
||||
p varchar2(15):='&1';
|
||||
cod varchar2(15);
|
||||
cod1 varchar2(15);
|
||||
desc_olo varchar2(15);
|
||||
tot NUMBER(15,0):=0;
|
||||
count_tot NUMBER(15,0):=0;
|
||||
num1 number(15,0):=0;
|
||||
num2 number(15,0):=0;
|
||||
num3 number(15,0):=0;
|
||||
num4 number(15,0):=0;
|
||||
num5 number(15,0):=0;
|
||||
num6 number(15,0):=0;
|
||||
num7 number(15,0):=0;
|
||||
num8 number(15,0):=0;
|
||||
num9 number(15,0):=0;
|
||||
num10 number(15,0):=0;
|
||||
num11 number(15,0):=0;
|
||||
num12 number(15,0):=0;
|
||||
num13 number(15,0):=0;
|
||||
num14 number(15,0):=0;
|
||||
num15 number(15,0):=0;
|
||||
num16 number(15,0):=0;
|
||||
num17 number(15,0):=0;
|
||||
num18 number(15,0):=0;
|
||||
num19 number(15,0):=0;
|
||||
num20 number(15,0):=0;
|
||||
num21 number(15,0):=0;
|
||||
num22 number(15,0):=0;
|
||||
num23 number(15,0):=0;
|
||||
num24 number(15,0):=0;
|
||||
num25 number(15,0):=0;
|
||||
num26 number(15,0):=0;
|
||||
num27 number(15,0):=0;
|
||||
num28 number(15,0):=0;
|
||||
num29 number(15,0):=0;
|
||||
num30 number(15,0):=0;
|
||||
totale1 NUMBER(15,0):=0;
|
||||
totale2 NUMBER(15,0):=0;
|
||||
totale3 NUMBER(15,0):=0;
|
||||
totale4 NUMBER(15,0):=0;
|
||||
totale5 NUMBER(15,0):=0;
|
||||
totale6 NUMBER(15,0):=0;
|
||||
totale7 NUMBER(15,0):=0;
|
||||
totale8 NUMBER(15,0):=0;
|
||||
totale9 NUMBER(15,0):=0;
|
||||
totale10 NUMBER(15,0):=0;
|
||||
totale11 NUMBER(15,0):=0;
|
||||
totale12 NUMBER(15,0):=0;
|
||||
totale13 NUMBER(15,0):=0;
|
||||
totale14 NUMBER(15,0):=0;
|
||||
totale15 NUMBER(15,0):=0;
|
||||
totale16 NUMBER(15,0):=0;
|
||||
totale17 NUMBER(15,0):=0;
|
||||
totale18 NUMBER(15,0):=0;
|
||||
totale19 NUMBER(15,0):=0;
|
||||
totale20 NUMBER(15,0):=0;
|
||||
totale21 NUMBER(15,0):=0;
|
||||
totale22 NUMBER(15,0):=0;
|
||||
totale23 NUMBER(15,0):=0;
|
||||
totale24 NUMBER(15,0):=0;
|
||||
totale25 NUMBER(15,0):=0;
|
||||
totale26 NUMBER(15,0):=0;
|
||||
totale27 NUMBER(15,0):=0;
|
||||
totale28 NUMBER(15,0):=0;
|
||||
totale29 NUMBER(15,0):=0;
|
||||
totale30 NUMBER(15,0):=0;
|
||||
|
||||
|
||||
-- Cursore degli operatori per la riga dei donating
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
--and desc_olo <> 'TIMG'
|
||||
order by desc_olo;
|
||||
|
||||
--Numero di linee portate tra operatori non TIM
|
||||
CURSOR cur_res(data_inizio date, data_fine date, operatore_ varchar2) is
|
||||
select nvl(sum(a.num),0),a.cod,a.cod1,b.desc_olo
|
||||
from mnp_olo_report b,
|
||||
(
|
||||
select count(*)num,codice_operatore_recipient cod,codice_operatore_donating cod1
|
||||
from mnp_gestione_richiesta_porting grp,
|
||||
(SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1) a
|
||||
where grp.stato in (4,6)
|
||||
and data_cut_over >= trunc(data_inizio)
|
||||
and data_cut_over <= trunc(data_fine)
|
||||
and grp.codice_operatore_donating = a.desc_olo
|
||||
and grp.codice_operatore_recipient = operatore_
|
||||
group by codice_operatore_recipient , codice_operatore_donating)a
|
||||
where a.cod1(+) = b.desc_olo
|
||||
and b.flag_attivo = 1
|
||||
group by a.cod,a.cod1,b.desc_olo
|
||||
order by b.desc_olo;
|
||||
------------------------------------------------
|
||||
|
||||
-- fine dichiarazione dei cursori
|
||||
-- inizio procedura
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
|
||||
else
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIM_to_AOM_NumeroLineePortate_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
BEGIN
|
||||
|
||||
--DBMS_OUTPUT.PUT_LINE('la data è....'|| data_inizio ||'...'|| data_fine);
|
||||
--data_inizio := to_date('01/05/2003', 'dd/mm/yyyy');
|
||||
--data_fine := to_date('31/05/2003', 'dd/mm/yyyy');
|
||||
UTL_FILE.put_line (file1,'Numero di linee portate tra operatori non TIM');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Terza Parte TIM');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
tot := 0;
|
||||
totale:= 0;
|
||||
OPEN cur_operatori;
|
||||
LOOP
|
||||
FETCH cur_operatori INTO ope_don;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
rs1:= rs1 ||';'|| ope_don ;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
rs1:=rs1 ||';'||'TOTALE';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.fflush (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
begin
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
tot:= 0;
|
||||
|
||||
OPEN cur_operatori;
|
||||
LOOP
|
||||
FETCH cur_operatori INTO ope_don;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
OPEN cur_res(data_inizio, data_fine,ope_don);
|
||||
LOOP
|
||||
FETCH cur_res INTO num,cod,cod1,desc_olo;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
count_tot := count_tot + 1;
|
||||
rs2 := '' || rs2 || num ||';';
|
||||
--DBMS_OUTPUT.PUT_LINE('sono qui......');
|
||||
|
||||
if (count_tot = 1) then
|
||||
num1:= num + num1;
|
||||
tot := num1 + tot;
|
||||
totale1:= totale1 + num1;
|
||||
|
||||
end if;
|
||||
if (count_tot = 2) then
|
||||
num2:= num + num2;
|
||||
tot := num2 + tot;
|
||||
totale2:= totale2 + num2;
|
||||
end if;
|
||||
if (count_tot = 3) then
|
||||
num3:= num + num3;
|
||||
tot := num3 + tot;
|
||||
totale3:= totale3 + num3;
|
||||
end if;
|
||||
if (count_tot = 4) then
|
||||
num4:= num + num4;
|
||||
tot := num4 + tot;
|
||||
totale4:= totale4 + num4;
|
||||
end if;
|
||||
if (count_tot = 5) then
|
||||
num5:= num + num5;
|
||||
tot := num5 + tot;
|
||||
totale5:= totale5 + num5;
|
||||
end if;
|
||||
if (count_tot = 6) then
|
||||
num6:= num + num6;
|
||||
tot := num6 + tot;
|
||||
totale6:= totale6 + num6;
|
||||
end if;
|
||||
if (count_tot = 7) then
|
||||
num7:= num + num7;
|
||||
tot := num7 + tot;
|
||||
totale7:= totale7 + num7;
|
||||
end if;
|
||||
if (count_tot = 8) then
|
||||
num8:= num + num8;
|
||||
tot := num8 + tot;
|
||||
totale8:= totale8 + num8;
|
||||
end if;
|
||||
if (count_tot = 9) then
|
||||
num9:= num + num9;
|
||||
tot := num9 + tot;
|
||||
totale9:= totale9 + num9;
|
||||
end if;
|
||||
if (count_tot = 10) then
|
||||
num10:= num + num10;
|
||||
tot := num10 + tot;
|
||||
totale10:= totale10 + num10;
|
||||
end if;
|
||||
if (count_tot = 11) then
|
||||
num11:= num + num11;
|
||||
tot := num11 + tot;
|
||||
totale11:= totale11 + num11;
|
||||
end if;
|
||||
if (count_tot = 12) then
|
||||
num12:= num + num12;
|
||||
tot := num12 + tot;
|
||||
totale12:= totale12 + num12;
|
||||
end if;
|
||||
if (count_tot = 13) then
|
||||
num13:= num + num13;
|
||||
tot := num13 + tot;
|
||||
totale13:= totale13 + num13;
|
||||
end if;
|
||||
if (count_tot = 14) then
|
||||
num14:= num + num14;
|
||||
tot := num14 + tot;
|
||||
totale14:= totale14 + num14;
|
||||
end if;
|
||||
if (count_tot = 15) then
|
||||
num15:= num + num15;
|
||||
tot := num15 + tot;
|
||||
totale15:= totale15 + num15;
|
||||
end if;
|
||||
if (count_tot = 16) then
|
||||
num16:= num + num16;
|
||||
tot := num16 + tot;
|
||||
totale16:= totale16 + num16;
|
||||
end if;
|
||||
if (count_tot = 17) then
|
||||
num17:= num + num17;
|
||||
tot := num17 + tot;
|
||||
totale17:= totale17 + num17;
|
||||
end if;
|
||||
if (count_tot = 18) then
|
||||
num18:= num + num18;
|
||||
tot := num18 + tot;
|
||||
totale18:= totale18 + num18;
|
||||
end if;
|
||||
if (count_tot = 19) then
|
||||
num19:= num + num19;
|
||||
tot := num19 + tot;
|
||||
totale19:= totale19 + num19;
|
||||
end if;
|
||||
if (count_tot = 20) then
|
||||
num20:= num + num20;
|
||||
tot := num20 + tot;
|
||||
totale20:= totale20 + num20;
|
||||
end if;
|
||||
if (count_tot = 21) then
|
||||
num21:= num + num21;
|
||||
tot := num21 + tot;
|
||||
totale21:= totale21 + num21;
|
||||
end if;
|
||||
if (count_tot = 22) then
|
||||
num22:= num + num22;
|
||||
tot := num22 + tot;
|
||||
totale22:= totale22 + num22;
|
||||
end if;
|
||||
if (count_tot = 23) then
|
||||
num23:= num + num23;
|
||||
tot := num23 + tot;
|
||||
totale23:= totale23 + num23;
|
||||
end if;
|
||||
if (count_tot = 24) then
|
||||
num24:= num + num24;
|
||||
tot := num24 + tot;
|
||||
totale24:= totale24 + num24;
|
||||
end if;
|
||||
if (count_tot = 25) then
|
||||
num25:= num + num25;
|
||||
tot := num25 + tot;
|
||||
totale25:= totale25 + num25;
|
||||
end if;
|
||||
if (count_tot = 26) then
|
||||
num26:= num + num26;
|
||||
tot := num26 + tot;
|
||||
totale26:= totale26 + num26;
|
||||
end if;
|
||||
if (count_tot = 27) then
|
||||
num27:= num + num10;
|
||||
tot := num27 + tot;
|
||||
totale27:= totale27 + num27;
|
||||
end if;
|
||||
if (count_tot = 28) then
|
||||
num28:= num + num28;
|
||||
tot := num28 + tot;
|
||||
totale28:= totale28 + num28;
|
||||
end if;
|
||||
if (count_tot = 29) then
|
||||
num29:= num + num29;
|
||||
tot := num29 + tot;
|
||||
totale29:= totale29 + num29;
|
||||
end if;
|
||||
if (count_tot = 30) then
|
||||
num30:= num + num30;
|
||||
tot := num30 + tot;
|
||||
totale30:= totale30 + num30;
|
||||
end if;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
|
||||
|
||||
UTL_FILE.put_line (file1,ope_don ||';'|| rs2 || tot ||';');
|
||||
UTL_FILE.fflush (file1);
|
||||
rs2 := '';
|
||||
tot := 0;
|
||||
num1 := 0;
|
||||
num2 := 0;
|
||||
num3 := 0;
|
||||
num4 := 0;
|
||||
num5 := 0;
|
||||
num6 := 0;
|
||||
num7 := 0;
|
||||
num8 := 0;
|
||||
num9 := 0;
|
||||
num10 := 0;
|
||||
num11 := 0;
|
||||
num12 := 0;
|
||||
num13 := 0;
|
||||
num14 := 0;
|
||||
num15 := 0;
|
||||
num16 := 0;
|
||||
num17 := 0;
|
||||
num18 := 0;
|
||||
num19 := 0;
|
||||
num20 := 0;
|
||||
num21 := 0;
|
||||
num22 := 0;
|
||||
num23 := 0;
|
||||
num24 := 0;
|
||||
num25 := 0;
|
||||
num26 := 0;
|
||||
num27 := 0;
|
||||
num28 := 0;
|
||||
num29 := 0;
|
||||
num30 := 0;
|
||||
|
||||
end loop;
|
||||
totale:= totale1+totale2+totale3+totale4+totale5+totale6+totale7+totale8+totale9+totale10+totale11+totale12+totale13+totale14+totale15+totale16+totale17+totale18+totale19+totale20+totale21+totale22+totale23+totale24+totale25+totale26+totale27+totale28+totale29+totale30;
|
||||
totale1 := totale1+totale6+totale11+totale16+totale21;
|
||||
totale2 := totale2+totale7+totale12+totale17+totale22;
|
||||
totale3 := totale3+totale8+totale13+totale18+totale23;
|
||||
totale4 := totale4+totale9+totale14+totale19+totale24;
|
||||
totale5 := totale5+totale10+totale15+totale20+totale25;
|
||||
UTL_FILE.put_line (file1,'TOTALE;'|| totale1 || ';'|| totale2 || ';'|| totale3 || ';'|| totale4 || ';'|| totale5 || ';'|| totale ||';');
|
||||
CLOSE cur_operatori;
|
||||
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs1 varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
operatore varchar2(15);
|
||||
dir_out varchar2(255);
|
||||
num NUMBER(15,0);
|
||||
totale NUMBER(15,0);
|
||||
cod_dig varchar2(1);
|
||||
cod varchar2(4);
|
||||
file1 UTL_FILE.file_type;
|
||||
data_inizio date;
|
||||
data_fine date;
|
||||
data date;
|
||||
di date;
|
||||
di date;
|
||||
p varchar2(15):='&1';
|
||||
|
||||
--Numero di richieste ricevute dalla rete di distribuzione nel periodo di riferimento
|
||||
CURSOR cur_res(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct msisdn) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec
|
||||
where codice_operatore_recipient = 'TIMG'
|
||||
and dataricezionerichiesta >= trunc(data_inizio)
|
||||
and dataricezionerichiesta <= trunc(data_fine)
|
||||
group by codice_operatore_donating
|
||||
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by olo.desc_olo;
|
||||
--------------------------------------------
|
||||
--INIZIO
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&3';
|
||||
|
||||
else
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIM_to_AOM_NumeroRichiesteRicevute_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (file1,'Numero di richieste ricevute dalla rete di distribuzione nel periodo di riferimento');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Recipient TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_res(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_res INTO operatore,num;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
rs1 := rs1 || operatore ||';';
|
||||
rs2 := rs2 || num ||';';
|
||||
totale := totale + num;
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
|
||||
rs1:=rs1 ||'TOTALE'||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/* Formatted on 200
|
||||
2/10/01 14:31 (Formatter Plus v4.5.2) */
|
||||
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs varchar2(255);
|
||||
ao_nome_file varchar2(255);
|
||||
mittente varchar2(255);
|
||||
ir_nome_file varchar2(255);
|
||||
errmsg varchar2(255);
|
||||
conta integer(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_rec is
|
||||
select distinct AO.nome_file , i.mittente , IR.nome_file , AO.errmsg
|
||||
from mnp_xml_ack_out AO, mnp_xml_in I, mnp_xml_richiesta_in IR, mnp_gestione_richiesta_rec R, mnp_xml_out xo
|
||||
where AO.risultato ='ERROR'
|
||||
and AO.nome_file_riferito = I.nome_file
|
||||
and I.tipo_file = 6
|
||||
and I.nome_file = IR.nome_file
|
||||
and I.mittente != R.codice_operatore_donating
|
||||
and IR.id_richiesta = R.id_richiesta
|
||||
and xo.nome_file = AO.nome_file
|
||||
and xo.tipo_file = 8
|
||||
and trunc(xo.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(xo.data_eff) >= decode(df,'nullo',trunc(xo.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select aom_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
end if;
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'TIM_to_AOM_AckKOESPLETAMENTIAOM_' || to_char(sysdate,'yyyyMMdd') || '.csv','w');
|
||||
UTL_FILE.put_line(file1,' Nome file ACK KO; Codice operatore AOM ; Nome file Espletamento Terzi; Messaggio errore ACK KO;');
|
||||
|
||||
conta := 0;
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO ao_nome_file,mittente,ir_nome_file,errmsg;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
select count(nome_file_riferito)into conta
|
||||
from mnp_xml_ack_out
|
||||
where nome_file_riferito = ir_nome_file
|
||||
and risultato != 'ERROR';
|
||||
|
||||
if (conta = 0) then
|
||||
UTL_FILE.put_line(file1,ao_nome_file ||';'|| mittente ||';'|| ir_nome_file ||';'|| errmsg);
|
||||
else
|
||||
conta:=0;
|
||||
end if;
|
||||
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,86 @@
|
||||
/* Formatted on 200
|
||||
2/10/01 14:31 (Formatter Plus v4.5.2) */
|
||||
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs varchar2(255);
|
||||
ao_nome_file varchar2(255);
|
||||
operatore_donating varchar2(255);
|
||||
ir_nome_file varchar2(255);
|
||||
errmsg varchar2(255);
|
||||
conta integer(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_rec is
|
||||
select distinct AO.nome_file , R.codice_operatore_donating , IR.nome_file , AO.errmsg
|
||||
from mnp_xml_ack_out AO, mnp_xml_in I, mnp_xml_richiesta_in IR, mnp_gestione_richiesta_rec R, mnp_xml_out xo
|
||||
where AO.risultato = 'ERROR'
|
||||
and AO.nome_file_riferito = I.nome_file
|
||||
and I.tipo_file = 6
|
||||
and I.nome_file = IR.nome_file
|
||||
and I.mittente = R.codice_operatore_donating
|
||||
and IR.id_richiesta = R.id_richiesta
|
||||
and xo.nome_file = AO.nome_file
|
||||
and xo.tipo_file = 8
|
||||
and trunc(xo.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(xo.data_eff) >= decode(df,'nullo',trunc(xo.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'TIM_to_AOM_AckKOESPLETAMENTIDONATING_' || to_char(sysdate,'yyyyMMdd') || '.csv','w');
|
||||
UTL_FILE.put_line(file1,' Nome file ACK KO; Codice operatore Donating ; Nome file Espletamento Donating; Messaggio errore ACK KO;');
|
||||
|
||||
conta := 0;
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO ao_nome_file,operatore_donating,ir_nome_file,errmsg;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
select count(nome_file_riferito) into conta
|
||||
from mnp_xml_ack_out
|
||||
where nome_file_riferito = ir_nome_file
|
||||
and risultato != 'ERROR';
|
||||
|
||||
if (conta = 0)then
|
||||
|
||||
UTL_FILE.put_line(file1,ao_nome_file ||';'|| operatore_donating ||';'|| ir_nome_file ||';'|| errmsg);
|
||||
else
|
||||
conta := 0;
|
||||
end if;
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,81 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_rec is
|
||||
/*select gr.id_richiesta || ';' || msisdn || ';' || st.descr_stato ||';'
|
||||
from mnp_gestione_richiesta gr, mnp_stato st, mnp_circe_out co, mnp_mss_cessazione_in ci
|
||||
where gr.stato in (14,15,16,17)
|
||||
AND gr.stato = st.id_stato
|
||||
and gr.id_richiesta=co.id_richiesta
|
||||
and co.da_inviare = 1;*/
|
||||
|
||||
select gr.id_richiesta ||';'|| gr.msisdn ||';'|| st.descr_stato ||';'
|
||||
from mnp_gestione_richiesta gr, mnp_stato st
|
||||
where gr.id_richiesta in
|
||||
(
|
||||
select id_richiesta from mnp_gestione_richiesta where stato in(15,16,17)
|
||||
minus
|
||||
select id_richiesta from mnp_circe_out where stato = '05'
|
||||
)
|
||||
and gr.stato = st.id_stato
|
||||
and trunc(gr.data_validazione_eff) >=decode(di,'nullo',trunc(gr.data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(gr.data_validazione_eff) <=decode(df,'nullo',trunc(gr.data_validazione_eff),to_date(df,'dd-MON-yy'))
|
||||
union
|
||||
select a.id_richiesta ||';'|| a.msisdn ||';'|| st.descr_stato ||';'
|
||||
from mnp_gestione_richiesta a, mnp_circe_out b, mnp_stato st
|
||||
where a.stato in(15,16,17)and a.id_richiesta = b.id_richiesta
|
||||
and b.stato = '05'
|
||||
and b.da_inviare = 1
|
||||
and a.stato = st.id_stato
|
||||
and trunc(a.data_validazione_eff) >=decode(di,'nullo',trunc(a.data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(a.data_validazione_eff) <=decode(df,'nullo',trunc(a.data_validazione_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen(dir_out,'DBC_CESSAZIONINONPERVENUTEACIRCE_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,' Codice Richiesta; MSISDN richiesta; Stato Richiesta;');
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO rs;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
WHEN others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,43 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
|
||||
CURSOR cur_rec is
|
||||
select gr.id_richiesta || ';' || gr.msisdn || ';' || st.descr_stato
|
||||
from mnp_gestione_richiesta gr, mnp_stato st, mnp_scarti_in si
|
||||
where si.sistema_prov = 'NPG-GMNP'
|
||||
--and gr.id_richiesta = si.id_richiesta
|
||||
and gr.msisdn= si.msisdn
|
||||
and si.codice_causale_rifiuto not like 'esito%'
|
||||
and si.codice_causale_rifiuto is not null
|
||||
and st.id_stato = gr.stato;
|
||||
|
||||
BEGIN
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
file1 := UTL_FILE.fopen(dir_out,'MSS_DBC_CESSAZIONI_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Codice Richiesta; MSISDN richiesta ; Stato Richiesta; ');
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO rs;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
WHEN others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
44
dbcmnpsrc/FE/mnpapp/script/report/sql/Report_ScartiCCRM.sql
Normal file
44
dbcmnpsrc/FE/mnpapp/script/report/sql/Report_ScartiCCRM.sql
Normal file
@@ -0,0 +1,44 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
|
||||
CURSOR cur_rec is
|
||||
select a.id_richiesta ||';' || b.msisdn ||';' || a.nome_file || ';'|| a.data_val_eff ||';'|| a.causale_scarto || ';'
|
||||
from mnp_ccrm_scarti_donor a, mnp_gestione_richiesta b
|
||||
where a.id_richiesta = b.id_richiesta(+)
|
||||
and trunc(data_inserimento) = trunc(sysdate);
|
||||
--and trunc(to_date(data_val_eff,'yyyy-MM-ddH24:mm:ss')) = to_char(trunc(sysdate-1), 'yyyy-MM-dd');
|
||||
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
file1 := UTL_FILE.fopen(dir_out,'CCRM_DBC_VALIDAZIONE_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Codice Richiesta;Msisdn; Nome File; Data validazione effettiva; Motivo scarto;');
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO rs;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,83 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
ao_nome_file varchar2(255);
|
||||
codice_donating varchar2(255);
|
||||
ir_nome_file varchar2(255);
|
||||
errmsg varchar2(255);
|
||||
dir_out varchar2(255);
|
||||
conta integer(5);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_rec is
|
||||
select distinct AO.nome_file , R.codice_operatore_donating , IR.nome_file ,AO.errmsg
|
||||
from mnp_xml_ack_out AO, mnp_xml_in I, mnp_xml_richiesta_in IR, mnp_gestione_richiesta_rec R, mnp_xml_out XO
|
||||
where AO.risultato='ERROR'
|
||||
and AO.nome_file_riferito = I.nome_file
|
||||
and I.tipo_file = 5
|
||||
and I.nome_file = IR.nome_file
|
||||
and IR.id_richiesta = R.id_richiesta
|
||||
and AO.nome_file = XO.nome_file
|
||||
and XO.tipo_file = 8
|
||||
and trunc(XO.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(XO.data_eff) >= decode(df,'nullo',trunc(XO.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'TIM_to_DONATING_AckKOPreseInCarico_' || to_char(sysdate,'yyyyMMdd') || '.csv','w');
|
||||
UTL_FILE.put_line(file1,'Nome file ACK KO; Codice operatore Donating ; Nome file Presa in carico; Messaggio errore ACK KO;');
|
||||
conta:= 0;
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO ao_nome_file, codice_donating, ir_nome_file, errmsg;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
select count(nome_file_riferito)into conta
|
||||
from mnp_xml_ack_out
|
||||
where nome_file_riferito = ir_nome_file
|
||||
and risultato !='ERROR';
|
||||
|
||||
if (conta= 0 ) then
|
||||
UTL_FILE.put_line(file1,ao_nome_file ||';'|| codice_donating ||';'|| ir_nome_file ||';'|| errmsg);
|
||||
else
|
||||
conta := 0;
|
||||
end if;
|
||||
--UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,72 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_rec is
|
||||
|
||||
|
||||
select gr.id_richiesta ||';'|| gr.msisdn ||';'|| st.descr_stato ||';'
|
||||
from mnp_gestione_richiesta gr, mnp_stato st
|
||||
where gr.id_richiesta in
|
||||
(
|
||||
select id_richiesta from mnp_gestione_richiesta where stato in(7,9,14,15,16)
|
||||
minus
|
||||
select id_richiesta from mnp_circe_out where stato = '02'
|
||||
)
|
||||
and gr.stato = st.id_stato
|
||||
and trunc(gr.data_validazione_eff) >=decode(di,'nullo',trunc(gr.data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(gr.data_validazione_eff) <=decode(df,'nullo',trunc(gr.data_validazione_eff),to_date(df,'dd-MON-yy'))
|
||||
union
|
||||
select a.id_richiesta ||';'|| a.msisdn ||';'|| st.descr_stato ||';'
|
||||
from mnp_gestione_richiesta a, mnp_circe_out b, mnp_stato st
|
||||
where a.stato in(7,9,14,15,16)and a.id_richiesta = b.id_richiesta
|
||||
and b.stato = '02'
|
||||
and b.da_inviare = 1
|
||||
and a.stato = st.id_stato
|
||||
and trunc(a.data_validazione_eff) >=decode(di,'nullo',trunc(a.data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(a.data_validazione_eff) <=decode(df,'nullo',trunc(a.data_validazione_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen(dir_out,'DBC_VALIDAZIONENONPERVENUTEACIRCE_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,' Codice Richiesta; MSISDN richiesta; Stato Richiesta;');
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO rs;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
WHEN OTHERS THEN
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
322
dbcmnpsrc/FE/mnpapp/script/report/sql/TIM_TerzaParte.sql
Normal file
322
dbcmnpsrc/FE/mnpapp/script/report/sql/TIM_TerzaParte.sql
Normal file
@@ -0,0 +1,322 @@
|
||||
SET serveroutput on
|
||||
|
||||
|
||||
|
||||
DECLARE
|
||||
|
||||
rs1 varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
operatore varchar2(15);
|
||||
operatore_donor varchar2(15);
|
||||
dir_out varchar2(255);
|
||||
num NUMBER(5,0);
|
||||
cod varchar2(15);
|
||||
cod1 varchar2(15);
|
||||
desc_olo varchar2(15);
|
||||
totale NUMBER(5,0);
|
||||
tot NUMBER(5,0);
|
||||
file1 UTL_FILE.file_type;
|
||||
count_tot NUMBER(5,0);
|
||||
num1 number(5,0);
|
||||
num2 number(5,0);
|
||||
num3 number(5,0);
|
||||
num4 number(5,0);
|
||||
num5 number(5,0);
|
||||
num6 number(5,0);
|
||||
num7 number(5,0);
|
||||
num8 number(5,0);
|
||||
num9 number(5,0);
|
||||
num10 number(5,0);
|
||||
totale1 NUMBER(5,0):=0;
|
||||
totale2 NUMBER(5,0):=0;
|
||||
totale3 NUMBER(5,0):=0;
|
||||
totale4 NUMBER(5,0):=0;
|
||||
totale5 NUMBER(5,0):=0;
|
||||
totale6 NUMBER(5,0):=0;
|
||||
totale7 NUMBER(5,0):=0;
|
||||
totale8 NUMBER(5,0):=0;
|
||||
totale9 NUMBER(5,0):=0;
|
||||
totale10 NUMBER(5,0):=0;
|
||||
data_inizio date;
|
||||
data_fine date;
|
||||
data date;
|
||||
di date;
|
||||
df date;
|
||||
ut varchar2(20);
|
||||
pippo varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_recipient is
|
||||
SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1;
|
||||
|
||||
|
||||
Cursor cur_select(operatore varchar2, data_inizio date, data_fine date) is
|
||||
--select nvl(to_char(sum(a.num)),'NULL'),
|
||||
select nvl(sum(a.num),0),
|
||||
a.cod,
|
||||
a.cod1,
|
||||
b.desc_olo
|
||||
|
||||
from mnp_olo_report b,
|
||||
(
|
||||
select count(*)num,
|
||||
codice_operatore_recipient cod,
|
||||
codice_operatore_donating cod1
|
||||
from
|
||||
mnp_gestione_richiesta_porting grp,
|
||||
mnp_mss_cess_porting_in ci,
|
||||
(SELECT desc_olo desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1) a
|
||||
|
||||
|
||||
where grp.stato in(4,6)
|
||||
and grp.msisdn = ci.msisdn
|
||||
and data_cut_over <> trunc(ci.data_ora_cessazione)
|
||||
and data_cut_over >= trunc(data_inizio)
|
||||
and data_cut_over <= trunc(data_fine)
|
||||
and grp.codice_operatore_donating = a.desc_olo
|
||||
and grp.codice_operatore_recipient = operatore
|
||||
group by codice_operatore_recipient , codice_operatore_donating
|
||||
|
||||
UNION
|
||||
select count(*)num,
|
||||
codice_operatore_recipient cod,
|
||||
codice_operatore_donating cod1
|
||||
from mnp_gestione_richiesta_porting grp,(SELECT desc_olo desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1) a
|
||||
|
||||
where grp.stato in(1,3,5)
|
||||
and data_cut_over >= trunc(data_inizio)
|
||||
and data_cut_over <= trunc(data_fine)
|
||||
and grp.codice_operatore_donating = a.desc_olo
|
||||
and grp.codice_operatore_recipient = operatore
|
||||
group by codice_operatore_recipient , codice_operatore_donating,a.desc_olo )a
|
||||
where a.cod1(+) = b.desc_olo
|
||||
and b.flag_attivo = 1
|
||||
group by a.cod,a.cod1,b.desc_olo
|
||||
order by b.desc_olo;
|
||||
|
||||
|
||||
BEGIN
|
||||
if (pippo <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
end if;
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIM_TerzaParte_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
BEGIN
|
||||
UTL_FILE.put_line (file1,'Titolo: Non effettuati da TIM in qualita di OLO il giorno del cut_over');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio)|| ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Terza Parte TIM');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
|
||||
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
tot:=0;
|
||||
OPEN cur_recipient;
|
||||
LOOP
|
||||
FETCH cur_recipient INTO operatore;
|
||||
EXIT WHEN cur_recipient%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
rs1:= rs1 ||';'|| operatore ;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_recipient;
|
||||
rs1:=rs1 ||';'||'TOTALE';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.fflush (file1);
|
||||
--UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
begin
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
tot :=0;
|
||||
num1 := 0;
|
||||
num2 := 0;
|
||||
num3 := 0;
|
||||
num4 := 0;
|
||||
num5 := 0;
|
||||
num6 := 0;
|
||||
num7 := 0;
|
||||
num8 := 0;
|
||||
num9 := 0;
|
||||
num10 := 0;
|
||||
OPEN cur_recipient;
|
||||
|
||||
|
||||
LOOP
|
||||
FETCH cur_recipient INTO operatore;
|
||||
EXIT WHEN cur_recipient%NOTFOUND;
|
||||
|
||||
OPEN cur_select(operatore,data_inizio, data_fine);
|
||||
|
||||
count_tot := 0;
|
||||
totale := 0;
|
||||
tot:=0;
|
||||
|
||||
|
||||
LOOP
|
||||
FETCH cur_select INTO num,cod,cod1,desc_olo;
|
||||
EXIT WHEN cur_select%NOTFOUND;
|
||||
--dbms_output.put_line('desc_olo '|| desc_olo);
|
||||
|
||||
--rs1:= cod1 ||';' || rs1 || ';'|| num ||';';
|
||||
|
||||
|
||||
|
||||
count_tot := count_tot + 1;
|
||||
rs2 := '' || rs2 || num ||';';
|
||||
|
||||
|
||||
if (count_tot = 1) then
|
||||
num1:= num + num1;
|
||||
|
||||
tot := num1 + tot;
|
||||
totale1:= totale1 + num1;
|
||||
--dbms_output.put_line('num 1 e...' || num1 || 'num...' || num ||'count_tot'||count_tot ||'operatore cod'|| cod ||'cod1'||cod1);
|
||||
end if;
|
||||
if (count_tot = 2) then
|
||||
num2:= num + num2;
|
||||
|
||||
tot := num2 + tot;
|
||||
totale2:= totale2 + num2;
|
||||
--dbms_output.put_line('num 2 e...' || num2 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 3) then
|
||||
num3:= num + num3;
|
||||
|
||||
tot := num3 + tot;
|
||||
totale3:= totale3 + num3;
|
||||
--dbms_output.put_line('num 3 e...' || num3 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 4) then
|
||||
num4:= num + num4;
|
||||
--dbms_output.put_line('tot e...' || tot);
|
||||
tot := num4 + tot;
|
||||
totale4:= totale4 + num4;
|
||||
--dbms_output.put_line('num 4 e...' || num4 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 5) then
|
||||
num5:= num + num5;
|
||||
|
||||
tot := num5 + tot;
|
||||
totale5:= totale5 + num5;
|
||||
--dbms_output.put_line('num 5 e...' || num5 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 6) then
|
||||
num6:= num + num6;
|
||||
|
||||
tot := num6 + tot;
|
||||
totale6:= totale6 + num6;
|
||||
--dbms_output.put_line('num 6 e...' || num6 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 7) then
|
||||
num7:= num + num7;
|
||||
|
||||
tot := num7 + tot;
|
||||
totale7:= totale7 + num7;
|
||||
--dbms_output.put_line('num 7 e...' || num7 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 8) then
|
||||
num8:= num + num8;
|
||||
|
||||
tot := num8 + tot;
|
||||
totale8:= totale8 + num8;
|
||||
--dbms_output.put_line('num 8 e...' || num8 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 9) then
|
||||
num9:= num + num9;
|
||||
|
||||
tot := num9 + tot;
|
||||
totale9:= totale9 + num9;
|
||||
--dbms_output.put_line('num 9 e...' || num9 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
if (count_tot = 10) then
|
||||
num10:= num + num10;
|
||||
|
||||
tot := num10 + tot;
|
||||
totale10:= totale10 + num10;
|
||||
--dbms_output.put_line('num 10 e...' || num10 || 'num...' || num ||'count_tot'||count_tot);
|
||||
end if;
|
||||
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_select;
|
||||
|
||||
UTL_FILE.put_line (file1,operatore ||';'|| rs2 || tot ||';');
|
||||
rs2 := '';
|
||||
tot := 0;
|
||||
num1 := 0;
|
||||
num2 := 0;
|
||||
num3 := 0;
|
||||
num4 := 0;
|
||||
num5 := 0;
|
||||
num6 := 0;
|
||||
num7 := 0;
|
||||
num8 := 0;
|
||||
num9 := 0;
|
||||
num10 := 0;
|
||||
|
||||
END LOOP;
|
||||
--totale := 0;
|
||||
totale:= totale1+totale2+totale3+totale4+totale5+totale6+totale7+totale8+totale9+totale10;
|
||||
UTL_FILE.put_line (file1,'TOTALE;'|| totale1 || ';'|| totale2 || ';'|| totale3 || ';'|| totale4 || ';'|| totale5 || ';'|| totale ||';');
|
||||
-- UTL_FILE.put_line (file1, arr(count_tot));
|
||||
--dbms_output.put_line('ciao fine loop ');
|
||||
|
||||
CLOSE cur_recipient;
|
||||
|
||||
|
||||
--rs1:= rs1;
|
||||
--rs2:= rs2 || totale ||';';
|
||||
--UTL_FILE.put_line (file1,rs1);
|
||||
--UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,731 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs1 varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
operatore varchar2(15);
|
||||
dir_out varchar2(255);
|
||||
num NUMBER(15,0);
|
||||
totale NUMBER(15,0);
|
||||
cod_dig varchar2(1);
|
||||
cod varchar2(4);
|
||||
file1 UTL_FILE.file_type;
|
||||
data_inizio date;
|
||||
data_fine date;
|
||||
data date;
|
||||
di date;
|
||||
di date;
|
||||
p varchar2(15):='&1';
|
||||
data_pivot_ date;
|
||||
gg_val_ number(03):=0;
|
||||
|
||||
--Numero portati nella quindicina per operatore recipient(donor timg)
|
||||
CURSOR cur_res(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.msisdn) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r,mnp_mss_cessazione_in ci -- mnp_xml_out o, mnp_xml_richiesta_out ro,
|
||||
where r.msisdn = ci.msisdn
|
||||
and r.stato in(15, 16)
|
||||
and r.codice_operatore_donating = 'TIMG'
|
||||
and trunc(ci.data_ora_cessazione) >= trunc(data_inizio)
|
||||
and trunc(ci.data_ora_cessazione) <= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMT'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
-----------------------------------------
|
||||
-- Numero portati nella quindicina per operatore recipient(donor timt)
|
||||
CURSOR cur_result(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.msisdn) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_mss_cessazione_in ci-- mnp_xml_out o, mnp_xml_richiesta_out ro,
|
||||
where r.msisdn = ci.msisdn
|
||||
and r.stato in(15, 16)
|
||||
and r.codice_operatore_donating ='TIMT'
|
||||
and trunc(ci.data_ora_cessazione) >= trunc(data_inizio)
|
||||
and trunc(ci.data_ora_cessazione) <= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
------------------------------------------------
|
||||
--Totale cumulativo del numero portati valutato dall'avvio della MNP alla fine del periodo indicato per operatore Recipient');
|
||||
|
||||
CURSOR cur_risul(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.msisdn) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_mss_cessazione_in ci --mnp_xml_out o, mnp_xml_richiesta_out ro,
|
||||
where r.msisdn = ci.msisdn
|
||||
and r.stato in(15, 16)
|
||||
and r.codice_operatore_donating ='TIMG'
|
||||
and trunc(ci.data_ora_cessazione)<= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
----------------------------------------------------------
|
||||
-- Numero richieste inviate dal recipient a TIMT nel periodo indicato')
|
||||
CURSOR cur_risult(data_inizio date, data_fine date) is
|
||||
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct(b.id_richiesta)) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_storico_richiesta b
|
||||
where b.id_richiesta = r.id_richiesta
|
||||
and b.stato_a = 1
|
||||
and b.data_lavorazione >= trunc(data_inizio)
|
||||
and b.data_lavorazione <= trunc(data_fine)
|
||||
and r.codice_operatore_donating = 'TIMT'
|
||||
group by codice_operatore_recipient
|
||||
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMT'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
|
||||
----------------------------------------------------------
|
||||
--Totale cumulativo del numero portati valutato dall'avvio della MNP alla fine del periodo indicato per operatore Recipient')
|
||||
|
||||
CURSOR result(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.msisdn) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_mss_cessazione_in ci-- mnp_xml_out o, mnp_xml_richiesta_out ro,
|
||||
where r.msisdn = ci.msisdn
|
||||
and r.stato in(15, 16)
|
||||
and r.codice_operatore_donating = 'TIMT'
|
||||
and trunc(ci.data_ora_cessazione)<= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMT'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
|
||||
----------------------------------------------------------
|
||||
-- Numero richieste inviate dal recipient a TIMG nel periodo indicato')
|
||||
CURSOR res(data_inizio date, data_fine date) is
|
||||
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct(b.id_richiesta)) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_storico_richiesta b
|
||||
where b.id_richiesta = r.id_richiesta
|
||||
and b.stato_a = 1
|
||||
and b.data_lavorazione >= trunc(data_inizio)
|
||||
and b.data_lavorazione <= trunc(data_fine)
|
||||
and r.codice_operatore_donating = 'TIMG'
|
||||
group by codice_operatore_recipient
|
||||
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
|
||||
----------------------------------------------------------
|
||||
--Numero di richieste che hanno avuto un ritardo per la validazione superiore a 5 giorni nel periodo indicato
|
||||
CURSOR resu(data_inizio date, data_fine date, data_pivot_ date, gg_val_ number) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.id_richiesta) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out ro
|
||||
where r.id_richiesta = ro.id_richiesta
|
||||
and r.dataricezionerichiesta < data_pivot_
|
||||
and r.codice_operatore_donating = 'TIMT'
|
||||
and ro.nome_file = o.nome_file
|
||||
and trunc(r.data_validazione_eff) > r.data_validazione_max + 5
|
||||
and trunc(r.data_validazione_eff) >= trunc(data_inizio)
|
||||
and trunc(r.data_validazione_eff) <= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
union all
|
||||
select count(distinct r.id_richiesta) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out ro
|
||||
where r.id_richiesta = ro.id_richiesta
|
||||
and r.dataricezionerichiesta >= data_pivot_
|
||||
and r.codice_operatore_donating = 'TIMT'
|
||||
and ro.nome_file = o.nome_file
|
||||
and trunc(r.data_validazione_eff) > r.data_validazione_max + gg_val_
|
||||
and trunc(r.data_validazione_eff) >= trunc(data_inizio)
|
||||
and trunc(r.data_validazione_eff) <= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
|
||||
----------------------------------------------------------
|
||||
--Numero di richieste che hanno avuto un ritardo per la validazione superiore a 5 giorni nel periodo indicato
|
||||
CURSOR res_cur(data_inizio date, data_fine date, data_pivot_ date, gg_val_ number) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.id_richiesta) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out ro
|
||||
where r.id_richiesta = ro.id_richiesta
|
||||
and r.dataricezionerichiesta < data_pivot_
|
||||
and r.codice_operatore_donating = 'TIMG'
|
||||
and ro.nome_file = o.nome_file
|
||||
and trunc(r.data_validazione_eff) > r.data_validazione_max + 5
|
||||
and trunc(r.data_validazione_eff) >= trunc(data_inizio)
|
||||
and trunc(r.data_validazione_eff) <= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
union all
|
||||
select count(distinct r.id_richiesta) num , codice_operatore_recipient cod
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out ro
|
||||
where r.id_richiesta = ro.id_richiesta
|
||||
and r.dataricezionerichiesta >= data_pivot_
|
||||
and r.codice_operatore_donating = 'TIMG'
|
||||
and ro.nome_file = o.nome_file
|
||||
and trunc(r.data_validazione_eff) > r.data_validazione_max + gg_val_
|
||||
and trunc(r.data_validazione_eff) >= trunc(data_inizio)
|
||||
and trunc(r.data_validazione_eff) <= trunc(data_fine)
|
||||
group by codice_operatore_recipient
|
||||
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
----------------------------------------------------------
|
||||
--Numero di disattivazione non effettuate da TIMT il giorno previsto per il cut-over durante il periodo indicato
|
||||
CURSOR res_cursor(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo, sum(nvl(cnt,0))
|
||||
from mnp_olo_report olo,
|
||||
(select codice_operatore_recipient op_rec, count(distinct r.msisdn)cnt
|
||||
from mnp_gestione_richiesta r, mnp_xml_out i, mnp_xml_richiesta_out xi
|
||||
where r.id_richiesta = xi.id_richiesta
|
||||
and r.codice_operatore_donating = 'TIMT'
|
||||
and r.data_cut_over_calc >= data_inizio
|
||||
and r.data_cut_over_calc <= data_fine
|
||||
and xi.nome_file = i.nome_file
|
||||
and i.tipo_file=6
|
||||
and substr(richiestaxml,instr(richiestaxml,'<DATA_CUT_OVER>',1,1)+15,10)<>to_char(r.data_cut_over_calc,'yyyy-mm-dd')
|
||||
and r.codice_operatore_recipient = i.destinatario
|
||||
group by r.codice_operatore_recipient
|
||||
union
|
||||
select codice_operatore_recipient op_rec, count(distinct r.msisdn)cnt
|
||||
from mnp_gestione_richiesta r
|
||||
where r.stato in (9,14,15)
|
||||
and r.codice_operatore_donating='TIMT'
|
||||
and r.data_cut_over_calc >= data_inizio
|
||||
and r.data_cut_over_calc <= data_fine
|
||||
group by r.codice_operatore_recipient
|
||||
order by op_rec )a
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = a.op_rec(+)
|
||||
group by olo.desc_olo;
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Numero di disattivazione non effettuate da TIMT il giorno previsto per il cut-over durante il periodo indicato
|
||||
CURSOR cursore(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo, sum(nvl(cnt,0))
|
||||
from mnp_olo_report olo,
|
||||
(select codice_operatore_recipient op_rec, count(distinct r.msisdn)cnt
|
||||
from mnp_gestione_richiesta r, mnp_xml_out i, mnp_xml_richiesta_out xi
|
||||
where r.id_richiesta = xi.id_richiesta
|
||||
and r.codice_operatore_donating = 'TIMG'
|
||||
and r.data_cut_over_calc >= data_inizio
|
||||
and r.data_cut_over_calc <= data_fine
|
||||
and xi.nome_file = i.nome_file
|
||||
and i.tipo_file=6
|
||||
and substr(richiestaxml,instr(richiestaxml,'<DATA_CUT_OVER>',1,1)+15,10)<>to_char(r.data_cut_over_calc,'yyyy-mm-dd')
|
||||
and r.codice_operatore_recipient = i.destinatario
|
||||
group by r.codice_operatore_recipient
|
||||
union
|
||||
select codice_operatore_recipient op_rec, count(distinct r.msisdn)cnt
|
||||
from mnp_gestione_richiesta r
|
||||
where r.stato in (9,14,15)
|
||||
and r.codice_operatore_donating='TIMG'
|
||||
and r.data_cut_over_calc >= data_inizio
|
||||
and r.data_cut_over_calc <= data_fine
|
||||
group by r.codice_operatore_recipient
|
||||
order by op_rec )a
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMT'
|
||||
and olo.desc_olo = a.op_rec(+)
|
||||
group by olo.desc_olo;
|
||||
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&3';
|
||||
else
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
|
||||
select data_pivot, gg_val
|
||||
into data_pivot_, gg_val_
|
||||
from mnp_data_report;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIM_to_AGCOM_DON_richiesteportate_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (file1,'Numero portati nella quindicina per operatore recipient');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_res(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_res INTO operatore,num;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
rs1:=rs1 ||'TOTALE'||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (file1,'Numero portati nella quindicina per operatore recipient');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMT');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_result(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_result INTO operatore,num;
|
||||
EXIT WHEN cur_result%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_result;
|
||||
rs1:=rs1 ||'TOTALE'||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Totale cumulativo del numero portati valutato dall'''|| 'avvio della MNP alla fine del periodo indicato per operatore Recipient');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo fino al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_risul(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_risul INTO operatore,num;
|
||||
EXIT WHEN cur_risul%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_risul;
|
||||
rs1:=rs1 ||'TOTALE'||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Totale cumulativo del numero portati valutato dall'''|| 'avvio della MNP alla fine del periodo indicato per operatore Recipient');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo fino al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMT');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN result(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH result INTO operatore,num;
|
||||
EXIT WHEN result%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE result;
|
||||
rs1:=rs1 ||'TOTALE'||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Numero richieste inviate dal recipient a TIMT nel periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMT');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_risult(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_risult INTO operatore,num;
|
||||
EXIT WHEN cur_risult%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_risult;
|
||||
rs1:=rs1 ||'TOTALE' ||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Numero richieste inviate dal recipient a TIMG nel periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN res(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH res INTO operatore,num;
|
||||
EXIT WHEN res%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE res;
|
||||
rs1:=rs1 ||'TOTALE' ||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Numero di richieste che hanno avuto un ritardo per la validazione superiore a 5 giorni nel periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMT');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN resu(data_inizio, data_fine, data_pivot_, gg_val_);
|
||||
LOOP
|
||||
FETCH resu INTO operatore,num;
|
||||
EXIT WHEN resu%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE resu;
|
||||
rs1:=rs1 ||'TOTALE' ||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Numero di richieste che hanno avuto un ritardo per la validazione superiore a 5 giorni nel periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN res_cur(data_inizio, data_fine, data_pivot_, gg_val_);
|
||||
LOOP
|
||||
FETCH res_cur INTO operatore,num;
|
||||
EXIT WHEN res_cur%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE res_cur;
|
||||
rs1:=rs1 ||'TOTALE' ||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Numero di disattivazione non effettuate da TIMT il giorno previsto per il cut-over durante il periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMT');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN res_cursor(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH res_cursor INTO operatore,num;
|
||||
EXIT WHEN res_cursor%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE res_cursor;
|
||||
rs1:=rs1 ||'TOTALE'||';';
|
||||
rs2:=rs2 || totale ||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Numero di disattivazione non effettuate da TIMG il giorno previsto per il cut-over durante il periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Donor TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cursore(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cursore INTO operatore,num;
|
||||
EXIT WHEN cursore%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cursore;
|
||||
rs1:=rs1||'TOTALE'||';';
|
||||
rs2:=rs2||totale||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,414 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs1 varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
operatore varchar2(15);
|
||||
dir_out varchar2(255);
|
||||
num NUMBER(15,0);
|
||||
totale NUMBER(15,0);
|
||||
cod_dig varchar2(1);
|
||||
data_inizio date;
|
||||
data_fine date;
|
||||
data date;
|
||||
data_i varchar2(15);
|
||||
d_i NUMBER(15);
|
||||
m_i NUMBER(15);
|
||||
a_i NUMBER(15);
|
||||
d_f NUMBER(15);
|
||||
file1 UTL_FILE.file_type;
|
||||
di date;
|
||||
di date;
|
||||
p varchar2(15):='&1';
|
||||
data_pivot_ date;
|
||||
gg_val_ number(03):=0;
|
||||
|
||||
--- PRENDO LA DATA DI CREAZIONE DEL MSG. DI ESPLETAMENTO COME DATA DI CESSAZIONE DELL'OPERATORE
|
||||
CURSOR cur_res(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.msisdn) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec r, mnp_mss_attivazione_in_rec a
|
||||
where r.stato in (11,12)
|
||||
and r.msisdn = a.msisdn
|
||||
and a.cod = 'I'
|
||||
and a.imsi is not null
|
||||
and a.rgn is null
|
||||
and trunc(a.data_ora_cessazione) >= trunc(data_inizio)
|
||||
and trunc(a.data_ora_cessazione) <= trunc(data_fine)
|
||||
group by r.codice_operatore_donating
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
|
||||
--------------------------------------------
|
||||
CURSOR cur_ris(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.msisdn) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec r, mnp_mss_attivazione_in_rec a
|
||||
where r.stato in(11,12)
|
||||
and r.msisdn = a.msisdn
|
||||
and a.cod = 'I'
|
||||
and a.imsi is not null
|
||||
and a.rgn is null
|
||||
and trunc(a.data_ora_cessazione) <= trunc(data_fine)
|
||||
group by r.codice_operatore_donating
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
------------------------------------------------
|
||||
CURSOR cur_risult(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct(a.id_richiesta)) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec a, mnp_storico_richiesta_rec b
|
||||
where a.id_richiesta = b.id_richiesta
|
||||
and b.stato_a = 4
|
||||
and b.data_lavorazione >= trunc(data_inizio)
|
||||
and b.data_lavorazione <= trunc(data_fine)
|
||||
and a.codice_operatore_donating <>'TIMT'
|
||||
group by codice_operatore_donating
|
||||
union
|
||||
select count(*), codice_operatore_donating
|
||||
from mnp_gestione_richiesta_rec a
|
||||
where codice_operatore_donating ='TIMT'
|
||||
and a.dataricezionerichiesta >= trunc(data_inizio)
|
||||
and a.dataricezionerichiesta <= trunc(data_fine)
|
||||
group by codice_operatore_donating
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
-------------------------------------------------------
|
||||
CURSOR cur_risultato(data_inizio date, data_fine date, data_pivot_ date, gg_val_ number) is
|
||||
select olo.desc_olo,nvl(X.num,0)
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.id_richiesta) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec r
|
||||
where r.dataricezionerichiesta < data_pivot_
|
||||
and trunc(r.data_validazione_eff) > r.data_validazione_max + 5
|
||||
and trunc(r.data_validazione_eff) >= trunc(data_inizio)
|
||||
and trunc(r.data_validazione_eff) <= trunc(data_fine)
|
||||
group by r.codice_operatore_donating
|
||||
union all
|
||||
select count(distinct r.id_richiesta) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec r
|
||||
where r.dataricezionerichiesta >= data_pivot_
|
||||
and trunc(r.data_validazione_eff) > r.data_validazione_max + gg_val_
|
||||
and trunc(r.data_validazione_eff) >= trunc(data_inizio)
|
||||
and trunc(r.data_validazione_eff) <= trunc(data_fine)
|
||||
group by r.codice_operatore_donating
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
order by desc_olo;
|
||||
-------------------------------------------
|
||||
CURSOR risultato(data_inizio date, data_fine date) is
|
||||
select olo.desc_olo,sum(nvl(X.num,0))
|
||||
from mnp_olo_report olo, (
|
||||
select count(distinct r.msisdn) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec r, mnp_xml_in i, mnp_xml_richiesta_in ri
|
||||
where r.id_richiesta = ri.id_richiesta
|
||||
and r.data_cut_over_aom >= trunc(data_inizio)
|
||||
and r.data_cut_over_aom <= trunc(data_fine)
|
||||
and substr(richiestaxml,instr(richiestaxml,'<DATA_CUT_OVER>',1,1)+15,10)<>to_char(r.data_cut_over_aom,'yyyy-mm-dd')
|
||||
and ri.nome_file = i.nome_file
|
||||
and i.tipo_file = 6
|
||||
and r.codice_operatore_donating = i.mittente
|
||||
group by r.codice_operatore_donating
|
||||
union
|
||||
select count(distinct r.msisdn) num , codice_operatore_donating cod
|
||||
from mnp_gestione_richiesta_rec r
|
||||
where r.stato in (8,10,11)
|
||||
and r.data_cut_over_aom >= trunc(data_inizio)
|
||||
and r.data_cut_over_aom <= trunc(data_fine)
|
||||
and r.espletamentodonating = 0
|
||||
group by r.codice_operatore_donating
|
||||
) X
|
||||
where olo.flag_attivo = 1
|
||||
and olo.desc_olo <> 'TIMG'
|
||||
and olo.desc_olo = x.cod(+)
|
||||
group by olo.desc_olo order by desc_olo;
|
||||
------------------------------------------------------------------------------------------------
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&3';
|
||||
else
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
|
||||
select data_pivot, gg_val
|
||||
into data_pivot_, gg_val_
|
||||
from mnp_data_report;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIM_to_AGCOM_REC_richiesteportate_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (file1,'Numero portati nella quindicina per operatore donating');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Recipient TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_res(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_res INTO operatore,num;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
rs1:=rs1||'TOTALE'||';';
|
||||
rs2:=rs2||totale||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Titolo: Totale cumulativo del numero portati valutato dall'''|| ' avvio della MNP alla fine del periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo fino al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Recipient TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_ris(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_ris INTO operatore,num;
|
||||
EXIT WHEN cur_ris%NOTFOUND;
|
||||
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_ris;
|
||||
rs1:=rs1||'TOTALE'||';';
|
||||
rs2:=rs2||totale||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Titolo: Numero di richieste inviate da TIMG al donating nel periodo di riferimento');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Recipient TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_risult(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH cur_risult INTO operatore,num;
|
||||
EXIT WHEN cur_risult%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_risult;
|
||||
rs1:=rs1||'TOTALE'||';';
|
||||
rs2:=rs2||totale||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Titolo: Numero di richieste che hanno avuto un ritardo per la validazione superiore a 5 giorni nel periodo indicato');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Recipient TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN cur_risultato(data_inizio, data_fine, data_pivot_, gg_val_);
|
||||
LOOP
|
||||
FETCH cur_risultato INTO operatore,num;
|
||||
EXIT WHEN cur_risultato%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE cur_risultato;
|
||||
rs1:=rs1||'TOTALE'||';';
|
||||
rs2:=rs2||totale||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Titolo: Numero disattivazioni non effettuate dal Donating il giorno previsto per il cut-over durante il periodo di riferimento');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo dal '|| trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Recipient TIMG');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
rs1:='';
|
||||
rs2:='';
|
||||
totale:=0;
|
||||
OPEN risultato(data_inizio, data_fine);
|
||||
LOOP
|
||||
FETCH risultato INTO operatore,num;
|
||||
EXIT WHEN risultato%NOTFOUND;
|
||||
rs1:=rs1||operatore||';';
|
||||
rs2:=rs2||num||';';
|
||||
totale:=totale+num;
|
||||
END LOOP;
|
||||
CLOSE risultato;
|
||||
rs1:=rs1||'TOTALE'||';';
|
||||
rs2:=rs2||totale||';';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.put_line (file1,rs2);
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
delete mnp_tab_temp;
|
||||
commit;
|
||||
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
fileout UTL_FILE.file_type;
|
||||
APPO1 number(3);
|
||||
operatore_ VARCHAR2(250);
|
||||
dir_out VARCHAR2(255);
|
||||
rs1 varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
totale NUMBER(15):=0;
|
||||
data_cut_over Date;
|
||||
giorni number(15);
|
||||
giorni1 number(15):=0;
|
||||
maxgiorni number(15):=0;
|
||||
maxgg number(15):=0;
|
||||
tot_giorni number(15):=0;
|
||||
id_richiesta VARCHAR2(230);
|
||||
richiestaadhoc number(15);
|
||||
num number(15):=0;
|
||||
tota number(15):=0;
|
||||
gg varchar2(15):='';
|
||||
prova VARCHAR2(255):='';
|
||||
tot_rec_appo number (20) := 1;
|
||||
data_inizio date;
|
||||
data_fine date;
|
||||
data_i date;
|
||||
di date;
|
||||
df date;
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
data_pivot_ date;
|
||||
gg_lav_ number(02):=0;
|
||||
dataricezric date;
|
||||
DATA DATE;
|
||||
|
||||
|
||||
CURSOR conteggio_95X100 (operatore_ varchar2) is
|
||||
select count(t.operatore)/100*95
|
||||
from mnp_tab_temp t
|
||||
where t.operatore = operatore_;
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in('TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
|
||||
CURSOR cur_richieste(operatore_ varchar2, data_inizio date, data_fine date) is
|
||||
select (abs(r.data_cut_over_calc - s.data_lavorazione))-sum(decode(tip_gio,'F',1,'P',1,0)) giorni, r.id_richiesta,r.dataricezionerichiesta
|
||||
from mnp_gestione_richiesta_rec r, mnp_storico_richiesta_rec s, s_dim_tempo sd
|
||||
where r.id_richiesta = s.id_richiesta
|
||||
and s.data_lavorazione >= data_inizio
|
||||
and s.data_lavorazione <= data_fine
|
||||
and r.stato = s.stato_a
|
||||
and r.stato = 12
|
||||
and r.richiestaadhoc = 0
|
||||
and r.codice_operatore_donating = operatore_
|
||||
and data between r.data_cut_over_calc and s.data_lavorazione
|
||||
and data <sysdate
|
||||
group by r.id_richiesta,
|
||||
(r.data_cut_over_calc - s.data_lavorazione),
|
||||
r.dataricezionerichiesta
|
||||
order by giorni;
|
||||
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
---- terminato il calcolo dei giorni ed inizio i calcoli del 95%
|
||||
--leggo nella tabella mnp_data_report la data e i giorni che poi dovrò aggiungere per completare il 95%
|
||||
-- la data mi serve per controllare che per ogni richiesta la data di ricezione richiesta sia maggiore
|
||||
-- o minore della data_pivot.
|
||||
-- se la dataricezionerichiesta < data_pivot
|
||||
-- aggiungo 10gg lavorativi ai giorni della richiesta per completare il 95% considerando il pregresso
|
||||
-- altrimenti
|
||||
-- aggiungo 5gg lavorativi calcolando il 95% con le nuove modifche per le date
|
||||
|
||||
select data_pivot, gg_lav
|
||||
into data_pivot_, gg_lav_
|
||||
from mnp_data_report;
|
||||
|
||||
|
||||
fileout := UTL_FILE.fopen (dir_out, 'Tempo_massimo_95x100_numeri_portati_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
UTL_FILE.put_line (fileout, 'Titolo: tempo massimo per completare il 95% dei numeri portati nel periodo');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Periodo dal ' || trunc(data_inizio) || ' al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Operatore Recipient TIMG ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
begin
|
||||
|
||||
OPEN cur_operatori;
|
||||
rs1 := '';
|
||||
rs2 := '';
|
||||
totale := 0;
|
||||
tot_giorni := 0;
|
||||
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore_;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
rs1:= rs1 || operatore_ ||';';
|
||||
APPO1 := 0;
|
||||
OPEN cur_richieste(operatore_, data_inizio, data_fine);
|
||||
tot_rec_appo := 0;
|
||||
LOOP
|
||||
FETCH cur_richieste INTO giorni,id_richiesta,dataricezric;
|
||||
EXIT WHEN cur_richieste%NOTFOUND;
|
||||
|
||||
tot_rec_appo := tot_rec_appo +1;
|
||||
APPO1 := 1;
|
||||
|
||||
insert into mnp_tab_temp
|
||||
values(tot_rec_appo,id_richiesta, giorni,operatore_,dataricezric);
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_richieste;
|
||||
COMMIT;
|
||||
|
||||
IF APPO1 = 1
|
||||
then -- HA TROVATO record per l'operatore
|
||||
num := 1;
|
||||
giorni1 := null;
|
||||
maxgiorni := null;
|
||||
maxgg := null;
|
||||
begin
|
||||
select nvl(max(id_record),0)
|
||||
into maxgg
|
||||
from mnp_tab_temp t
|
||||
where t.operatore = operatore_;
|
||||
exception
|
||||
when no_data_found then
|
||||
maxgg :=0;
|
||||
end;
|
||||
maxgiorni := maxgg/100*95;
|
||||
|
||||
|
||||
begin
|
||||
SELECT t.giorni
|
||||
INTO giorni1
|
||||
FROM mnp_tab_temp t
|
||||
where t.id_record= maxgiorni
|
||||
and t.operatore = operatore_;
|
||||
|
||||
|
||||
exception when no_data_found then
|
||||
giorni1 := 0;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
if (dataricezric < data_pivot_) then
|
||||
|
||||
giorni1 := giorni1 +10;
|
||||
else
|
||||
giorni1 := giorni1 +gg_lav_;
|
||||
end if;
|
||||
ELSE
|
||||
giorni1 := 0;
|
||||
END IF;
|
||||
|
||||
|
||||
rs2 := rs2 || giorni1 ||';';
|
||||
tot_giorni := tot_giorni + giorni1;
|
||||
|
||||
commit;
|
||||
|
||||
|
||||
END LOOP;
|
||||
|
||||
|
||||
|
||||
-- Stampa Totali
|
||||
rs1:= rs1 ||'TOTALE';
|
||||
rs2:= rs2 || to_char(tot_giorni) ||';';
|
||||
UTL_FILE.put_line (fileout,rs1);
|
||||
UTL_FILE.put_line (fileout,rs2);
|
||||
|
||||
|
||||
CLOSE cur_operatori;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
end;
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,448 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs1 varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
operatore varchar2(15);
|
||||
ope_don varchar2(15);
|
||||
dir_out varchar2(255);
|
||||
num NUMBER(15,0):=0;
|
||||
totale NUMBER(15,0):=0;
|
||||
file1 UTL_FILE.file_type;
|
||||
data_fine date;
|
||||
data date;
|
||||
p varchar2(15):='&1';
|
||||
cod varchar2(15);
|
||||
cod1 varchar2(15);
|
||||
desc_olo varchar2(15);
|
||||
tot NUMBER(15,0):=0;
|
||||
count_tot NUMBER(15,0):=0;
|
||||
num1 number(15,0):=0;
|
||||
num2 number(15,0):=0;
|
||||
num3 number(15,0):=0;
|
||||
num4 number(15,0):=0;
|
||||
num5 number(15,0):=0;
|
||||
num6 number(15,0):=0;
|
||||
num7 number(15,0):=0;
|
||||
num8 number(15,0):=0;
|
||||
num9 number(15,0):=0;
|
||||
num10 number(15,0):=0;
|
||||
num11 number(15,0):=0;
|
||||
num12 number(15,0):=0;
|
||||
num13 number(15,0):=0;
|
||||
num14 number(15,0):=0;
|
||||
num15 number(15,0):=0;
|
||||
num16 number(15,0):=0;
|
||||
num17 number(15,0):=0;
|
||||
num18 number(15,0):=0;
|
||||
num19 number(15,0):=0;
|
||||
num20 number(15,0):=0;
|
||||
num21 number(15,0):=0;
|
||||
num22 number(15,0):=0;
|
||||
num23 number(15,0):=0;
|
||||
num24 number(15,0):=0;
|
||||
num25 number(15,0):=0;
|
||||
num26 number(15,0):=0;
|
||||
num27 number(15,0):=0;
|
||||
num28 number(15,0):=0;
|
||||
num29 number(15,0):=0;
|
||||
num30 number(15,0):=0;
|
||||
totale1 NUMBER(15,0):=0;
|
||||
totale2 NUMBER(15,0):=0;
|
||||
totale3 NUMBER(15,0):=0;
|
||||
totale4 NUMBER(15,0):=0;
|
||||
totale5 NUMBER(15,0):=0;
|
||||
totale6 NUMBER(15,0):=0;
|
||||
totale7 NUMBER(15,0):=0;
|
||||
totale8 NUMBER(15,0):=0;
|
||||
totale9 NUMBER(15,0):=0;
|
||||
totale10 NUMBER(15,0):=0;
|
||||
totale11 NUMBER(15,0):=0;
|
||||
totale12 NUMBER(15,0):=0;
|
||||
totale13 NUMBER(15,0):=0;
|
||||
totale14 NUMBER(15,0):=0;
|
||||
totale15 NUMBER(15,0):=0;
|
||||
totale16 NUMBER(15,0):=0;
|
||||
totale17 NUMBER(15,0):=0;
|
||||
totale18 NUMBER(15,0):=0;
|
||||
totale19 NUMBER(15,0):=0;
|
||||
totale20 NUMBER(15,0):=0;
|
||||
totale21 NUMBER(15,0):=0;
|
||||
totale22 NUMBER(15,0):=0;
|
||||
totale23 NUMBER(15,0):=0;
|
||||
totale24 NUMBER(15,0):=0;
|
||||
totale25 NUMBER(15,0):=0;
|
||||
totale26 NUMBER(15,0):=0;
|
||||
totale27 NUMBER(15,0):=0;
|
||||
totale28 NUMBER(15,0):=0;
|
||||
totale29 NUMBER(15,0):=0;
|
||||
totale30 NUMBER(15,0):=0;
|
||||
|
||||
|
||||
-- Cursore degli operatori per la riga dei donating
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
--and desc_olo <> 'TIMG'
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
--Totale cumulativo numero di linee portate tra operatori non TIM
|
||||
CURSOR cur_risul(data_fine date,operatore_ varchar2) is
|
||||
select nvl(sum(a.num),0),a.cod,a.cod1,b.desc_olo
|
||||
from mnp_olo_report b,
|
||||
(
|
||||
select count(*)num,codice_operatore_recipient cod,codice_operatore_donating cod1
|
||||
from mnp_gestione_richiesta_porting grp,
|
||||
(SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1) a
|
||||
where grp.stato in (4,6)
|
||||
and data_cut_over <= trunc(data_fine)
|
||||
and grp.codice_operatore_donating = a.desc_olo
|
||||
and grp.codice_operatore_recipient = operatore_
|
||||
group by codice_operatore_recipient , codice_operatore_donating)a
|
||||
where a.cod1(+) = b.desc_olo
|
||||
and b.flag_attivo = 1
|
||||
group by a.cod,a.cod1,b.desc_olo
|
||||
order by b.desc_olo;
|
||||
------------------------------------------------------------------
|
||||
-- fine dichiarazione dei cursori
|
||||
-- inizio procedura
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
data_fine := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
|
||||
else
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIM_to_AOM_TotaleNumeroLineePortate_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
rs1 := '';
|
||||
rs2 := '';
|
||||
--ope_don := '';
|
||||
tot := 0;
|
||||
num1 := 0;
|
||||
num2 := 0;
|
||||
num3 := 0;
|
||||
num4 := 0;
|
||||
num5 := 0;
|
||||
num6 := 0;
|
||||
num7 := 0;
|
||||
num8 := 0;
|
||||
num9 := 0;
|
||||
num10 := 0;
|
||||
num11 := 0;
|
||||
num12 := 0;
|
||||
num13 := 0;
|
||||
num14 := 0;
|
||||
num15 := 0;
|
||||
num16 := 0;
|
||||
num17 := 0;
|
||||
num18 := 0;
|
||||
num19 := 0;
|
||||
num20 := 0;
|
||||
num21 := 0;
|
||||
num22 := 0;
|
||||
num23 := 0;
|
||||
num24 := 0;
|
||||
num25 := 0;
|
||||
num26 := 0;
|
||||
num27 := 0;
|
||||
num28 := 0;
|
||||
num29 := 0;
|
||||
num30 := 0;
|
||||
|
||||
totale := 0;
|
||||
totale1 := 0;
|
||||
totale2 := 0;
|
||||
totale3 := 0;
|
||||
totale4 := 0;
|
||||
totale5 := 0;
|
||||
totale6 := 0;
|
||||
totale7 := 0;
|
||||
totale8 := 0;
|
||||
totale9 := 0;
|
||||
totale10 := 0;
|
||||
totale11 := 0;
|
||||
totale12 := 0;
|
||||
totale13 := 0;
|
||||
totale14 := 0;
|
||||
totale15 := 0;
|
||||
totale16 := 0;
|
||||
totale17 := 0;
|
||||
totale18 := 0;
|
||||
totale19 := 0;
|
||||
totale20 := 0;
|
||||
totale21 := 0;
|
||||
totale22 := 0;
|
||||
totale23 := 0;
|
||||
totale24 := 0;
|
||||
totale25 := 0;
|
||||
totale26 := 0;
|
||||
totale27 := 0;
|
||||
totale28 := 0;
|
||||
totale29 := 0;
|
||||
totale30 := 0;
|
||||
count_tot := 0;
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Totale cumulativo numero di linee portate tra operatori non TIM');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Periodo fino al '|| trunc(data_fine));
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
UTL_FILE.put_line (file1,'Operatore Terza Parte TIM');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
|
||||
OPEN cur_operatori;
|
||||
LOOP
|
||||
FETCH cur_operatori INTO ope_don;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
rs1:= rs1 ||';'|| ope_don ;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
rs1:=rs1 ||';'||'TOTALE';
|
||||
UTL_FILE.put_line (file1,rs1);
|
||||
UTL_FILE.fflush (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
begin
|
||||
|
||||
rs1 := '';
|
||||
rs2 := '';
|
||||
|
||||
OPEN cur_operatori;
|
||||
LOOP
|
||||
FETCH cur_operatori INTO ope_don;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
OPEN cur_risul(data_fine,ope_don);
|
||||
LOOP
|
||||
FETCH cur_risul INTO num,cod,cod1,desc_olo;
|
||||
EXIT WHEN cur_risul%NOTFOUND;
|
||||
|
||||
count_tot := count_tot + 1;
|
||||
rs2 := '' || rs2 || num ||';';
|
||||
|
||||
|
||||
if (count_tot = 1) then
|
||||
num1:= num + num1;
|
||||
tot := num1 + tot;
|
||||
totale1:= totale1 + num1;
|
||||
|
||||
end if;
|
||||
if (count_tot = 2) then
|
||||
num2:= num + num2;
|
||||
tot := num2 + tot;
|
||||
totale2:= totale2 + num2;
|
||||
end if;
|
||||
if (count_tot = 3) then
|
||||
num3:= num + num3;
|
||||
tot := num3 + tot;
|
||||
totale3:= totale3 + num3;
|
||||
end if;
|
||||
if (count_tot = 4) then
|
||||
num4:= num + num4;
|
||||
tot := num4 + tot;
|
||||
totale4:= totale4 + num4;
|
||||
end if;
|
||||
if (count_tot = 5) then
|
||||
num5:= num + num5;
|
||||
tot := num5 + tot;
|
||||
totale5:= totale5 + num5;
|
||||
end if;
|
||||
if (count_tot = 6) then
|
||||
num6:= num + num6;
|
||||
tot := num6 + tot;
|
||||
totale6:= totale6 + num6;
|
||||
end if;
|
||||
if (count_tot = 7) then
|
||||
num7:= num + num7;
|
||||
tot := num7 + tot;
|
||||
totale7:= totale7 + num7;
|
||||
end if;
|
||||
if (count_tot = 8) then
|
||||
num8:= num + num8;
|
||||
tot := num8 + tot;
|
||||
totale8:= totale8 + num8;
|
||||
end if;
|
||||
if (count_tot = 9) then
|
||||
num9:= num + num9;
|
||||
tot := num9 + tot;
|
||||
totale9:= totale9 + num9;
|
||||
end if;
|
||||
if (count_tot = 10) then
|
||||
num10:= num + num10;
|
||||
tot := num10 + tot;
|
||||
totale10:= totale10 + num10;
|
||||
end if;
|
||||
if (count_tot = 11) then
|
||||
num11:= num + num11;
|
||||
tot := num11 + tot;
|
||||
totale11:= totale11 + num11;
|
||||
end if;
|
||||
if (count_tot = 12) then
|
||||
num12:= num + num12;
|
||||
tot := num12 + tot;
|
||||
totale12:= totale12 + num12;
|
||||
end if;
|
||||
if (count_tot = 13) then
|
||||
num13:= num + num13;
|
||||
tot := num13 + tot;
|
||||
totale13:= totale13 + num13;
|
||||
end if;
|
||||
if (count_tot = 14) then
|
||||
num14:= num + num14;
|
||||
tot := num14 + tot;
|
||||
totale14:= totale14 + num14;
|
||||
end if;
|
||||
if (count_tot = 15) then
|
||||
num15:= num + num15;
|
||||
tot := num15 + tot;
|
||||
totale15:= totale15 + num15;
|
||||
end if;
|
||||
if (count_tot = 16) then
|
||||
num16:= num + num16;
|
||||
tot := num16 + tot;
|
||||
totale16:= totale16 + num16;
|
||||
end if;
|
||||
if (count_tot = 17) then
|
||||
num17:= num + num17;
|
||||
tot := num17 + tot;
|
||||
totale17:= totale17 + num17;
|
||||
end if;
|
||||
if (count_tot = 18) then
|
||||
num18:= num + num18;
|
||||
tot := num18 + tot;
|
||||
totale18:= totale18 + num18;
|
||||
end if;
|
||||
if (count_tot = 19) then
|
||||
num19:= num + num19;
|
||||
tot := num19 + tot;
|
||||
totale19:= totale19 + num19;
|
||||
end if;
|
||||
if (count_tot = 20) then
|
||||
num20:= num + num20;
|
||||
tot := num20 + tot;
|
||||
totale20:= totale20 + num20;
|
||||
end if;
|
||||
if (count_tot = 21) then
|
||||
num21:= num + num21;
|
||||
tot := num21 + tot;
|
||||
totale21:= totale21 + num21;
|
||||
end if;
|
||||
if (count_tot = 22) then
|
||||
num22:= num + num22;
|
||||
tot := num22 + tot;
|
||||
totale22:= totale22 + num22;
|
||||
end if;
|
||||
if (count_tot = 23) then
|
||||
num23:= num + num23;
|
||||
tot := num23 + tot;
|
||||
totale23:= totale23 + num23;
|
||||
end if;
|
||||
if (count_tot = 24) then
|
||||
num24:= num + num24;
|
||||
tot := num24 + tot;
|
||||
totale24:= totale24 + num24;
|
||||
end if;
|
||||
if (count_tot = 25) then
|
||||
num25:= num + num25;
|
||||
tot := num25 + tot;
|
||||
totale25:= totale25 + num25;
|
||||
end if;
|
||||
if (count_tot = 26) then
|
||||
num26:= num + num26;
|
||||
tot := num26 + tot;
|
||||
totale26:= totale26 + num26;
|
||||
end if;
|
||||
if (count_tot = 27) then
|
||||
num27:= num + num10;
|
||||
tot := num27 + tot;
|
||||
totale27:= totale27 + num27;
|
||||
end if;
|
||||
if (count_tot = 28) then
|
||||
num28:= num + num28;
|
||||
tot := num28 + tot;
|
||||
totale28:= totale28 + num28;
|
||||
end if;
|
||||
if (count_tot = 29) then
|
||||
num29:= num + num29;
|
||||
tot := num29 + tot;
|
||||
totale29:= totale29 + num29;
|
||||
end if;
|
||||
if (count_tot = 30) then
|
||||
num30:= num + num30;
|
||||
tot := num30 + tot;
|
||||
totale30:= totale30 + num30;
|
||||
end if;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_risul;
|
||||
|
||||
-- DBMS_OUTPUT.PUT_LINE('count_tot è....' || count_tot ||'.... tot e....'|| tot ||'...desc_olo....'|| ope_don);
|
||||
UTL_FILE.put_line (file1,ope_don||';'|| rs2 || tot ||';');
|
||||
UTL_FILE.fflush (file1);
|
||||
rs2 := '';
|
||||
tot := 0;
|
||||
num1 := 0;
|
||||
num2 := 0;
|
||||
num3 := 0;
|
||||
num4 := 0;
|
||||
num5 := 0;
|
||||
num6 := 0;
|
||||
num7 := 0;
|
||||
num8 := 0;
|
||||
num9 := 0;
|
||||
num10 := 0;
|
||||
|
||||
end loop;
|
||||
totale:= totale1+totale2+totale3+totale4+totale5+totale6+totale7+totale8+totale9+totale10+totale11+totale12+totale13+totale14+totale15+totale16+totale17+totale18+totale19+totale20+totale21+totale22+totale23+totale24+totale25+totale26+totale27+totale28+totale29+totale30;
|
||||
totale1 := totale1+totale6+totale11+totale16+totale21;
|
||||
totale2 := totale2+totale7+totale12+totale17+totale22;
|
||||
totale3 := totale3+totale8+totale13+totale18+totale23;
|
||||
totale4 := totale4+totale9+totale14+totale19+totale24;
|
||||
totale5 := totale5+totale10+totale15+totale20+totale25;
|
||||
UTL_FILE.put_line (file1,'TOTALE;'|| totale1 || ';'|| totale2 || ';'|| totale3 || ';'|| totale4 || ';'|| totale5 || ';'|| totale ||';');
|
||||
CLOSE cur_operatori;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
operatore varchar2(10);
|
||||
dir_out varchar2(255);
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, aom_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG','BLUI')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
DECLARE
|
||||
|
||||
codiceric varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
operatoredon varchar2(4);
|
||||
datavalidmax varchar2(10);
|
||||
datainvio Date;
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select a.id_richiesta, a.msisdn, a.codice_operatore_donating, to_char(a.data_validazione_max,'DD/MM/YYYY'),b.data_invio
|
||||
from mnp_gestione_richiesta_rec a,mnp_xml_out b, mnp_xml_richiesta_out c
|
||||
where a.id_richiesta = c.id_richiesta
|
||||
and c.nome_file = b.nome_file
|
||||
and a.stato = 6
|
||||
and a.codice_operatore_donating = operatore
|
||||
and trunc(decode(to_char(b.data_invio,'D'),1,b.data_invio+5, b.data_invio+7)) < trunc(sysdate)
|
||||
and to_char(b.data_invio,'dd/mm') not in(select to_char(data_festiva,'dd/mm')from mnp_date_festive)
|
||||
and exists (select max(id_prog)
|
||||
from mnp_xml_richiesta_out c
|
||||
where c.id_richiesta = a.id_richiesta);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| upper(operatore)||'_MANCATEVALIDAZIONI_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn; Operatore Donating; Data validazione attesa;');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO codiceric, msisdn,operatoredon,datavalidmax, datainvio;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,codiceric ||' ; '|| msisdn ||' ; ' || operatoredon || ' ; ' || datavalidmax || ' ;');
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
end;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,87 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
|
||||
|
||||
operatore varchar2(10);
|
||||
errore exception;
|
||||
rich_mese_pre_prp number(6);
|
||||
dir_out varchar2(255);
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, aom_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG','BLUI')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
declare
|
||||
|
||||
cod varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
op_don varchar2(4);
|
||||
data varchar2(10);
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select r.id_richiesta,r.msisdn,r.codice_operatore_donating, x.data_invio
|
||||
FROM mnp_gestione_richiesta_rec r, mnp_xml_out x, mnp_xml_richiesta_out xo
|
||||
WHERE r.id_richiesta = xo.id_richiesta
|
||||
AND r.stato = 4
|
||||
and r.codice_operatore_donating = operatore
|
||||
AND xo.nome_file = x.nome_file
|
||||
AND x.tipo_file = 1
|
||||
AND trunc(x.data_invio) <= trunc(sysdate-1)
|
||||
AND r.id_richiesta not in (
|
||||
select rr.id_richiesta
|
||||
from mnp_gestione_richiesta_rec rr, mnp_xml_in x, mnp_xml_richiesta_in xi
|
||||
where rr.id_richiesta=xi.id_richiesta
|
||||
AND r.id_richiesta = rr.id_richiesta
|
||||
AND xi.nome_file = x.nome_file
|
||||
AND x.tipo_file = 5
|
||||
);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| upper(operatore)||'_MANCATEPRESEINCARICO_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn; Operatore Donating; Data Invio;');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO cod,msisdn,op_don,data;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1, cod ||';'|| msisdn ||';'|| op_don||';'|| data ||';');
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
end;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
-- when errore then
|
||||
-- DBMS_OUTPUT.PUT_LINE('La data inserita è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,61 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
file1 UTL_FILE.file_type;
|
||||
i number;
|
||||
|
||||
BEGIN
|
||||
|
||||
FOR r_operatori in
|
||||
( select id_operatore
|
||||
from mnp_anagrafica_operatori ap
|
||||
where ap.id_operatore <> 'TIMG'
|
||||
and ap.tipo_operatore = 'RETE')
|
||||
LOOP
|
||||
i := 0;
|
||||
|
||||
FOR rec_ack_mancanti in
|
||||
( SELECT
|
||||
xml_out.nome_file nome_file_validazione,
|
||||
xml_out.mittente Operatore_Donating_Rete,
|
||||
xml_out.destinatario Operatore_Recipient_Rete,
|
||||
to_char(sysdate,'dd/mm/yyyy') data_evento_mancante
|
||||
FROM mnp.MNP_XML_OUT xml_out
|
||||
WHERE xml_out.TIPO_FILE = 2 ----VALIDAZIONE
|
||||
AND xml_out.data_eff
|
||||
BETWEEN trunc(sysdate) AND to_Date(to_char(sysdate,'ddmmyyyy')||'101500','ddmmyyyyhh24miss')
|
||||
AND mittente = 'TIMG'
|
||||
AND destinatario = r_operatori.id_operatore
|
||||
AND xml_out.nome_file not in
|
||||
(select nome_file_riferito from mnp_xml_ack_in)
|
||||
)
|
||||
LOOP
|
||||
|
||||
-- apertura del file e scrittura intestazioni
|
||||
if i = 0 then
|
||||
file1 := UTL_FILE.fopen ('MAV_OUT', 'TIMG_TO_'|| upper(r_operatori.id_operatore)||'_MAV_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Nome File Validazione;Operatore Donating di Rete;Operatore Recipient di Rete;Data Evento Mancante');
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line(file1,rec_ack_mancanti.nome_file_validazione||';'||rec_ack_mancanti.Operatore_Donating_Rete||';'||
|
||||
rec_ack_mancanti.Operatore_Recipient_Rete||';'||rec_ack_mancanti.data_evento_mancante);
|
||||
|
||||
i:= i + 1;
|
||||
END LOOP;
|
||||
|
||||
if UTL_FILE.is_open(file1) then
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
end if;
|
||||
|
||||
END LOOP;
|
||||
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,78 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
|
||||
|
||||
operatore varchar2(10);
|
||||
|
||||
errore exception;
|
||||
|
||||
rich_mese_pre_prp number(6);
|
||||
dir_out varchar2(255);
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, aom_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG','BLUI')
|
||||
order by desc_olo;
|
||||
|
||||
BEGIN
|
||||
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
declare
|
||||
|
||||
cod varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
op_don varchar2(4);
|
||||
esito varchar2(15);
|
||||
data varchar2(15);
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select r.id_richiesta, r.msisdn, r.codice_operatore_donating, to_char(r.data_cut_over_aom, 'DD/MM/YYYY'),'Mancante'
|
||||
from mnp_gestione_richiesta_rec r
|
||||
where r.stato in(8,10,11)
|
||||
and r.codice_operatore_donating = operatore
|
||||
and r.espletamentodonating = 0
|
||||
and data_cut_over_aom< trunc(sysdate);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| upper(operatore)||'_MANCATIESPLETAMENTI_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn; Operatore Donating; Esito(mancante/KO);');
|
||||
UTL_FILE.put_line (file1,'');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO cod,msisdn,op_don,data,esito;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,cod ||';'|| msisdn ||';'|| op_don ||';'|| esito ||';');
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
end;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
when errore then
|
||||
DBMS_OUTPUT.PUT_LINE('La data inserita è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,81 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
|
||||
|
||||
operatore varchar2(10);
|
||||
|
||||
errore exception;
|
||||
|
||||
rich_mese_pre_prp number(6);
|
||||
dir_out varchar2(255);
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, aom_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG','BLUI')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
declare
|
||||
|
||||
cod varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
op_don varchar2(4);
|
||||
data varchar2(15);
|
||||
file1 UTL_FILE.file_type;
|
||||
esito varchar2(15);
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select c.id_richiesta, c.msisdn, o.desc_olo, to_char(decode(c.data_cut_over_aom, null,c.data_cut_over_calc, c.data_cut_over_aom), 'DD/MM/YYYY'), 'Mancante'
|
||||
from mnp_gestione_richiesta_rec c, mnp_olo o
|
||||
where c.stato in(8,10,11)
|
||||
and o.desc_olo = operatore
|
||||
and c.espletamentoterzeparti like '%'|| o.cod_olo||'%'
|
||||
and decode(c.data_cut_over_aom, null, c.data_cut_over_calc,c.data_cut_over_aom)< trunc(sysdate);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| upper(operatore)||'_MANCATENOTIFICHETERZEPARTI_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn; Operatore Donating; Data invio;Esito(mancante/KO);');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO cod,msisdn,op_don,data,esito;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,cod ||';'|| msisdn ||';'|| op_don ||';'|| data ||';'|| esito ||';');
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
end;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
--when errore then
|
||||
-- DBMS_OUTPUT.PUT_LINE('La data inserita è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
535
dbcmnpsrc/FE/mnpapp/script/report/sql/report_AGCOM.sql
Normal file
535
dbcmnpsrc/FE/mnpapp/script/report/sql/report_AGCOM.sql
Normal file
@@ -0,0 +1,535 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
FILE UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
count_rifiuto number(5):=0;
|
||||
operatore_loop VARCHAR2(50);
|
||||
operatore VARCHAR2(50);
|
||||
count_tot number(5):=0;
|
||||
codice_rifiuto number(2):=0;
|
||||
desc_rifiuto varchar2(50);
|
||||
tot_op1 varchar2(10):=null;
|
||||
tot_op2 varchar2(10):=null;
|
||||
tot_op3 varchar2(10):=null;
|
||||
tot_op4 varchar2(10):=null;
|
||||
tot_op5 varchar2(10):=null;
|
||||
tot_op6 varchar2(10):=null;
|
||||
tot_op7 varchar2(10):=null;
|
||||
tot_op8 varchar2(10):=null;
|
||||
tot_op9 varchar2(10):=null;
|
||||
tot_op10 varchar2(10):=null;
|
||||
rs varchar2(255);
|
||||
rs2 varchar2(255);
|
||||
totali number(5):=0;
|
||||
dir_out VARCHAR2(255);
|
||||
tot_operatori varchar2(10):=0;
|
||||
data_inizio date;
|
||||
data_fine date;
|
||||
data date;
|
||||
di date;
|
||||
df date;
|
||||
ut varchar2(20);
|
||||
pippo varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo <> 'TIMT';
|
||||
|
||||
|
||||
CURSOR cur_ope is
|
||||
SELECT desc_olo,donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo <> 'TIMG';
|
||||
|
||||
cursor cur_codice_rif is
|
||||
select cod_causale_rifiuto, causale
|
||||
from mnp_causale_rifiuto
|
||||
where cod_causale_rifiuto in(1,2,3,4,5,6,7,8,9,10,11,12,13,14);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
OPEN cur_operatori;
|
||||
operatore_loop := '';
|
||||
|
||||
|
||||
|
||||
LOOP
|
||||
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
operatore_loop := operatore_loop || ';' || operatore;
|
||||
|
||||
END LOOP;
|
||||
|
||||
if (pippo <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIM_to_AGCOM_RICHIESTERIFIUTATE_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout, 'Titolo: Distribuzione richieste rifiutate per operatore recipient');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Periodo dal ' || trunc(data_inizio) ||' ' || 'al ' || trunc(data_fine));
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Operatore Donor TIMT ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Codice rifiuto; Motivo Rifiuto ' || ltrim(operatore_loop) ||';' ||' Totale'||';');
|
||||
|
||||
CLOSE cur_operatori;
|
||||
UTL_FILE.fflush (fileout);
|
||||
|
||||
|
||||
|
||||
begin
|
||||
|
||||
open cur_codice_rif;
|
||||
|
||||
loop
|
||||
FETCH cur_codice_rif INTO codice_rifiuto, desc_rifiuto;
|
||||
EXIT WHEN cur_codice_rif%NOTFOUND;
|
||||
count_tot := 0;
|
||||
OPEN cur_operatori;
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
select count(*)into count_rifiuto
|
||||
from mnp_gestione_richiesta gr, mnp_storico_richiesta sr
|
||||
where gr.id_richiesta = sr.id_richiesta
|
||||
and gr.stato = 10
|
||||
and gr.codice_operatore_recipient = operatore
|
||||
and gr.codice_operatore_donating = 'TIMT'
|
||||
and gr.codicerifiutovalidazione = codice_rifiuto
|
||||
and sr.data_lavorazione >= trunc(data_inizio)
|
||||
and sr.data_lavorazione <= trunc(data_fine)
|
||||
and sr.stato_a = 10;
|
||||
|
||||
if (count_tot = 0) then
|
||||
rs := codice_rifiuto || ';'|| desc_rifiuto ||';'|| count_rifiuto;
|
||||
totali := count_rifiuto;
|
||||
tot_op1 := nvl(tot_op1,0)+ count_rifiuto;
|
||||
elsif (count_tot = 1)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op2 := nvl(tot_op2,0)+ count_rifiuto;
|
||||
elsif (count_tot = 2)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op3 := nvl(tot_op3,0)+ count_rifiuto;
|
||||
elsif (count_tot = 3)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op4 := nvl(tot_op4,0)+ count_rifiuto;
|
||||
elsif (count_tot = 4)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op5 := nvl(tot_op5,0)+ count_rifiuto;
|
||||
elsif (count_tot = 5)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op6 := nvl(tot_op6,0)+ count_rifiuto;
|
||||
elsif (count_tot = 6)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op7 := nvl(tot_op7,0)+ count_rifiuto;
|
||||
elsif (count_tot = 7)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op8 := nvl(tot_op8,0)+ count_rifiuto;
|
||||
elsif (count_tot = 8)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op9 := nvl(tot_op9,0)+ count_rifiuto;
|
||||
elsif (count_tot = 9)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op10 := nvl(tot_op10,0)+ count_rifiuto;
|
||||
end if;
|
||||
|
||||
count_tot := count_tot +1;
|
||||
END LOOP;
|
||||
UTL_FILE.put_line (fileout,rs ||';' || totali);
|
||||
UTL_FILE.fflush (fileout);
|
||||
CLOSE cur_operatori;
|
||||
end loop;
|
||||
tot_operatori := nvl(tot_op1,0)+nvl(tot_op2,0)+nvl(tot_op3,0)+nvl(tot_op4,0)+nvl(tot_op5,0)+nvl(tot_op6,0)+nvl(tot_op7,0)+nvl(tot_op8,0)+nvl(tot_op9,0)+nvl(tot_op10,0);
|
||||
UTL_FILE.put_line (fileout,'Totale'|| ';'||';'|| nvl(tot_op1,'') || ';'|| nvl(tot_op2,'') ||';' || nvl(tot_op3,'') || ';'|| nvl(tot_op4,'') ||';'|| nvl(tot_op5,'') || nvl(tot_op6,'') || nvl(tot_op7,'') || nvl(tot_op8,'') || nvl(tot_op9,'') || nvl(tot_op10,'') || tot_operatori);
|
||||
UTL_FILE.fflush (fileout);
|
||||
|
||||
|
||||
close cur_codice_rif;
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
-- UTL_FILE.fclose (fileout);
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
-- when others then
|
||||
-- DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
begin
|
||||
if (pippo <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
|
||||
end if;
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Titolo: Distribuzione richieste rifiutate per operatore recipient');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Periodo dal ' || trunc(data_inizio) ||' ' || 'al ' || trunc(data_fine));
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Operatore Donor TIMG ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
OPEN cur_ope;
|
||||
operatore_loop := '';
|
||||
|
||||
LOOP
|
||||
FETCH cur_ope INTO operatore, dir_out;
|
||||
EXIT WHEN cur_ope%NOTFOUND;
|
||||
|
||||
|
||||
operatore_loop := operatore_loop || ';' || operatore;
|
||||
|
||||
END LOOP;
|
||||
UTL_FILE.put_line (fileout, 'Codice rifiuto; Motivo Rifiuto ' || ltrim(operatore_loop) ||';' ||' Totale'|| ';');
|
||||
|
||||
CLOSE cur_ope;
|
||||
UTL_FILE.fflush (fileout);
|
||||
END;
|
||||
|
||||
begin
|
||||
|
||||
tot_op1 :=null;
|
||||
tot_op2 :=null;
|
||||
tot_op3 :=null;
|
||||
tot_op4 :=null;
|
||||
tot_op5 :=null;
|
||||
tot_op6 :=null;
|
||||
tot_op7 :=null;
|
||||
tot_op8 :=null;
|
||||
tot_op9 :=null;
|
||||
tot_op10 :=null;
|
||||
rs := '';
|
||||
totali :=0;
|
||||
tot_operatori :=0;
|
||||
|
||||
|
||||
|
||||
open cur_codice_rif;
|
||||
|
||||
loop
|
||||
FETCH cur_codice_rif INTO codice_rifiuto, desc_rifiuto;
|
||||
EXIT WHEN cur_codice_rif%NOTFOUND;
|
||||
count_tot := 0;
|
||||
OPEN cur_ope;
|
||||
LOOP
|
||||
FETCH cur_ope INTO operatore, dir_out;
|
||||
EXIT WHEN cur_ope%NOTFOUND;
|
||||
|
||||
|
||||
select count(*)into count_rifiuto
|
||||
from mnp_gestione_richiesta gr, mnp_storico_richiesta sr
|
||||
where gr.id_richiesta = sr.id_richiesta
|
||||
and gr.stato = 10
|
||||
and gr.codice_operatore_recipient = operatore
|
||||
and gr.codice_operatore_donating = 'TIMG'
|
||||
and gr.codicerifiutovalidazione = codice_rifiuto
|
||||
and sr.data_lavorazione >= trunc(data_inizio)
|
||||
and sr.data_lavorazione <= trunc(data_fine)
|
||||
and sr.stato_a = 10;
|
||||
|
||||
|
||||
if (count_tot = 0) then
|
||||
rs := codice_rifiuto || ';'|| desc_rifiuto ||';'|| count_rifiuto;
|
||||
totali := count_rifiuto;
|
||||
tot_op1 := nvl(tot_op1,0)+ count_rifiuto;
|
||||
elsif (count_tot = 1)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op2 := nvl(tot_op2,0)+ count_rifiuto;
|
||||
elsif (count_tot = 2)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op3 := nvl(tot_op3,0)+ count_rifiuto;
|
||||
elsif (count_tot = 3)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op4 := nvl(tot_op4,0)+ count_rifiuto;
|
||||
elsif (count_tot = 4)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op5 := nvl(tot_op5,0)+ count_rifiuto;
|
||||
elsif (count_tot = 5)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op6 := nvl(tot_op6,0)+ count_rifiuto;
|
||||
elsif (count_tot = 6)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op7 := nvl(tot_op7,0)+ count_rifiuto;
|
||||
elsif (count_tot = 7)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op8 := nvl(tot_op8,0)+ count_rifiuto;
|
||||
elsif (count_tot = 8)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op9 := nvl(tot_op9,0)+ count_rifiuto;
|
||||
elsif (count_tot = 9)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op10 := nvl(tot_op10,0)+ count_rifiuto;
|
||||
end if;
|
||||
|
||||
count_tot := count_tot +1;
|
||||
END LOOP;
|
||||
UTL_FILE.put_line (fileout,rs ||';' || totali);
|
||||
UTL_FILE.fflush (fileout);
|
||||
CLOSE cur_ope;
|
||||
end loop;
|
||||
tot_operatori := nvl(tot_op1,0)+nvl(tot_op2,0)+nvl(tot_op3,0)+nvl(tot_op4,0)+nvl(tot_op5,0)+nvl(tot_op6,0)+nvl(tot_op7,0)+nvl(tot_op8,0)+nvl(tot_op9,0)+nvl(tot_op10,0);
|
||||
UTL_FILE.put_line (fileout,'Totale'||';'||';'|| nvl(tot_op1,'') || ';'|| nvl(tot_op2,'') ||';' || nvl(tot_op3,'') || ';'|| nvl(tot_op4,'') ||';'|| nvl(tot_op5,'') || nvl(tot_op6,'') || nvl(tot_op7,'') || nvl(tot_op8,'') || nvl(tot_op9,'') || nvl(tot_op10,'') || tot_operatori);
|
||||
UTL_FILE.fflush (fileout);
|
||||
|
||||
|
||||
close cur_codice_rif;
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
-- when others then
|
||||
-- DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
begin
|
||||
|
||||
if (pippo <> 'nullo')then
|
||||
data_inizio := to_date('&1','dd/mm/yyyy');
|
||||
data_fine := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
|
||||
|
||||
else
|
||||
if (to_char(sysdate, 'DD')<= '15') then
|
||||
|
||||
data := add_months((trunc(sysdate)), -1);
|
||||
data_inizio := to_date('16/'|| to_char(trunc(data), 'mm/yyyy'),'dd/mm/yyyy');
|
||||
data_fine := last_day(trunc(data));
|
||||
else
|
||||
data_inizio := to_date('01/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
data_fine := to_date('15/'|| to_char(trunc(sysdate), 'mm/yyyy'), 'dd/mm/yyyy');
|
||||
end if;
|
||||
|
||||
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Titolo: Distribuzione richieste rifiutate per operatore donating');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Periodo dal ' || trunc(data_inizio) ||' ' || 'al ' || trunc(data_fine));
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
UTL_FILE.put_line (fileout, 'Operatore Recipient TIMG ');
|
||||
UTL_FILE.put_line (fileout, ' ');
|
||||
end;
|
||||
begin
|
||||
|
||||
OPEN cur_ope;
|
||||
operatore_loop := '';
|
||||
|
||||
LOOP
|
||||
FETCH cur_ope INTO operatore, dir_out;
|
||||
EXIT WHEN cur_ope%NOTFOUND;
|
||||
|
||||
|
||||
operatore_loop := operatore_loop || ';' || operatore;
|
||||
|
||||
END LOOP;
|
||||
UTL_FILE.put_line (fileout, 'Codice rifiuto; Motivo Rifiuto ' || ltrim(operatore_loop) ||';' ||' Totale'|| ';');
|
||||
|
||||
CLOSE cur_ope;
|
||||
UTL_FILE.fflush (fileout);
|
||||
END;
|
||||
|
||||
begin
|
||||
|
||||
tot_op1 :=null;
|
||||
tot_op2 :=null;
|
||||
tot_op3 :=null;
|
||||
tot_op4 :=null;
|
||||
tot_op5 :=null;
|
||||
tot_op6 :=null;
|
||||
tot_op7 :=null;
|
||||
tot_op8 :=null;
|
||||
tot_op9 :=null;
|
||||
tot_op10 :=null;
|
||||
rs := '';
|
||||
totali :=0;
|
||||
tot_operatori :=0;
|
||||
|
||||
|
||||
|
||||
open cur_codice_rif;
|
||||
|
||||
loop
|
||||
FETCH cur_codice_rif INTO codice_rifiuto, desc_rifiuto;
|
||||
EXIT WHEN cur_codice_rif%NOTFOUND;
|
||||
count_tot := 0;
|
||||
OPEN cur_ope;
|
||||
LOOP
|
||||
FETCH cur_ope INTO operatore, dir_out;
|
||||
EXIT WHEN cur_ope%NOTFOUND;
|
||||
|
||||
/*
|
||||
select count(*)into count_rifiuto
|
||||
from mnp_gestione_richiesta gr, mnp_storico_richiesta sr
|
||||
where gr.id_richiesta = sr.id_richiesta
|
||||
and gr.stato = 10
|
||||
and gr.codice_operatore_recipient = 'TIMG'
|
||||
and gr.codice_operatore_donating = operatore
|
||||
and gr.codicerifiutovalidazione = codice_rifiuto
|
||||
and sr.data_lavorazione <= add_months(sysdate, -1)+ 15
|
||||
and sr.stato_a = 10;*/
|
||||
|
||||
select count(*)into count_rifiuto
|
||||
from mnp_gestione_richiesta_rec gr, mnp_storico_richiesta_rec sr
|
||||
where gr.id_richiesta = sr.id_richiesta
|
||||
and gr.stato = 7
|
||||
and gr.codice_operatore_recipient = 'TIMG'
|
||||
and gr.codice_operatore_donating = operatore
|
||||
and gr.codicerifiutovalidazione = codice_rifiuto
|
||||
and sr.data_lavorazione>= trunc(data_inizio)
|
||||
and sr.data_lavorazione <= trunc(data_fine)
|
||||
and sr.stato_a = 7;
|
||||
|
||||
|
||||
|
||||
if (count_tot = 0) then
|
||||
rs := codice_rifiuto || ';'|| desc_rifiuto ||';'|| count_rifiuto;
|
||||
totali := count_rifiuto;
|
||||
tot_op1 := nvl(tot_op1,0)+ count_rifiuto;
|
||||
elsif (count_tot = 1)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op2 := nvl(tot_op2,0)+ count_rifiuto;
|
||||
elsif (count_tot = 2)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op3 := nvl(tot_op3,0)+ count_rifiuto;
|
||||
elsif (count_tot = 3)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op4 := nvl(tot_op4,0)+ count_rifiuto;
|
||||
elsif (count_tot = 4)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op5 := nvl(tot_op5,0)+ count_rifiuto;
|
||||
elsif (count_tot = 5)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op6 := nvl(tot_op6,0)+ count_rifiuto;
|
||||
elsif (count_tot = 6)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op7 := nvl(tot_op7,0)+ count_rifiuto;
|
||||
elsif (count_tot = 7)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op8 := nvl(tot_op8,0)+ count_rifiuto;
|
||||
elsif (count_tot = 8)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op9 := nvl(tot_op9,0)+ count_rifiuto;
|
||||
elsif (count_tot = 9)then
|
||||
rs := rs ||';'|| count_rifiuto;
|
||||
totali := totali + count_rifiuto;
|
||||
tot_op10 := nvl(tot_op10,0)+ count_rifiuto;
|
||||
end if;
|
||||
|
||||
count_tot := count_tot +1;
|
||||
END LOOP;
|
||||
UTL_FILE.put_line (fileout,rs ||';' || totali);
|
||||
UTL_FILE.fflush (fileout);
|
||||
CLOSE cur_ope;
|
||||
end loop;
|
||||
tot_operatori := nvl(tot_op1,0)+nvl(tot_op2,0)+nvl(tot_op3,0)+nvl(tot_op4,0)+nvl(tot_op5,0)+nvl(tot_op6,0)+nvl(tot_op7,0)+nvl(tot_op8,0)+nvl(tot_op9,0)+nvl(tot_op10,0);
|
||||
UTL_FILE.put_line (fileout,'Totale'||';'||';'|| nvl(tot_op1,'') || ';'|| nvl(tot_op2,'') ||';' || nvl(tot_op3,'') || ';'|| nvl(tot_op4,'') ||';'|| nvl(tot_op5,'') || nvl(tot_op6,'') || nvl(tot_op7,'') || nvl(tot_op8,'') || nvl(tot_op9,'') || nvl(tot_op10,'') || tot_operatori);
|
||||
UTL_FILE.fflush (fileout);
|
||||
|
||||
|
||||
close cur_codice_rif;
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
-- when others then
|
||||
-- DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
operatore varchar2(15);
|
||||
errore exception;
|
||||
dir_out varchar2(255);
|
||||
rich_mese_pre_prp number(6);
|
||||
cod_olo number(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo,cod_olo, aom_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
BEGIN
|
||||
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, cod_olo,dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
declare
|
||||
|
||||
cod varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
descr_stato varchar2(40);
|
||||
data_cut_over DATE;
|
||||
data_cut_over_AOM DATE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CURSOR cur_res (cod_olo number)is
|
||||
select distinct a.id_richiesta,a.msisdn,b.descr_stato,a.data_cut_over_calc,data_cut_over_AOM
|
||||
from mnp_gestione_richiesta_rec a, mnp_stato_rec b
|
||||
where a.data_cut_over_calc >= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and a.data_cut_over_calc <= decode(df,'nullo',a.data_cut_over_calc,to_date(df,'dd-MON-yy'))
|
||||
and a.stato = b.id_stato
|
||||
and a.ESPLETAMENTOTERZEPARTI like '%' || cod_olo || '%'
|
||||
and a.codice_operatore_donating = 'TIMT'
|
||||
union
|
||||
select distinct a.id_richiesta,a.msisdn,b.descr_stato,a.data_cut_over_calc,a.data_cut_over_AOM
|
||||
from mnp_gestione_richiesta_rec a, mnp_stato_rec b
|
||||
where a.data_cut_over_AOM >= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and a.data_cut_over_AOM <= decode(df,'nullo',a.data_cut_over_AOM,to_date(df,'dd-MON-yy'))
|
||||
and a.stato = b.id_stato
|
||||
and a.ESPLETAMENTOTERZEPARTI like '%' || cod_olo || '%'
|
||||
and a.codice_operatore_donating != operatore
|
||||
and a.codice_operatore_recipient = 'TIMG';
|
||||
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, upper(operatore)||'_to_TIM_attivazioneinRitardo_come_AOM_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn; Stato Richiesta; Data Cut-Over-Calc;Data Cut-Over Donating;');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
OPEN cur_res(cod_olo);
|
||||
LOOP
|
||||
FETCH cur_res INTO cod, msisdn, descr_stato, data_cut_over,data_cut_over_AOM;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,cod ||';'|| msisdn ||';'|| descr_stato ||';'|| data_cut_over || ';'|| data_cut_over_AOM || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
|
||||
end;
|
||||
|
||||
END LOOP;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
--when errore then
|
||||
-- DBMS_OUTPUT.PUT_LINE('La data inserita è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,87 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
|
||||
|
||||
operatore varchar2(10);
|
||||
errore exception;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, recipient_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
BEGIN
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
declare
|
||||
|
||||
cod_richiesta varchar2(23);
|
||||
msisdn_richiesta varchar2(15);
|
||||
stato_richiesta varchar2(40);
|
||||
data_cut_over_donating varchar2(10);
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
CURSOR cur_ris is
|
||||
select a.id_richiesta,a.msisdn,b.descr_stato,a.data_cut_over_AOM
|
||||
from mnp_gestione_richiesta_rec a, mnp_stato_rec b
|
||||
where a.espletamentodonating = 0
|
||||
and a.stato = b.id_stato
|
||||
and a.data_cut_over_AOM <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and a.data_cut_over_AOM >= decode(df,'nullo',a.data_cut_over_AOM,to_date(df,'dd-MON-yy'))
|
||||
and a.codice_operatore_donating = operatore;
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, upper(operatore)||'_to_TIM_attivazioneinRitardo_come_Donating_'|| to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice Richiesta; MSISDN; Stato Richiesta; Data Cut-Over Donating;');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
OPEN cur_ris;
|
||||
LOOP
|
||||
FETCH cur_ris INTO cod_richiesta, msisdn_richiesta, stato_richiesta, data_cut_over_donating;
|
||||
EXIT WHEN cur_ris%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,cod_richiesta || ';' || msisdn_richiesta || ';' || stato_richiesta || ';' || data_cut_over_donating || ';');
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_ris;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
END;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
--when errore then
|
||||
-- DBMS_OUTPUT.PUT_LINE('la data è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,69 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(500);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out VARCHAR2(255);
|
||||
msisdn_ VARCHAR2(500);
|
||||
idrichiesta_ VARCHAR2(500);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_rec is
|
||||
/*select id_richiesta || ';' || msisdn || ';'
|
||||
from mnp_mss_cess_in mc
|
||||
where not exists (select distinct msisdn from mnp_gestione_richiesta gr where mc.msisdn = gr.msisdn);*/
|
||||
|
||||
select distinct a.msisdn, a.id_richiesta
|
||||
from mnp_gestione_richiesta a, mnp_mss_cessazione_in b
|
||||
where a.id_richiesta = b.id_richiesta
|
||||
and a.stato not in (15,16)
|
||||
and b.da_processare = 1
|
||||
and trunc(b.data_ora_cessazione) <=decode(di,'nullo',trunc(b.data_ora_cessazione),to_date(di,'dd-MON-yy'))
|
||||
and trunc(b.data_ora_cessazione) >=decode(df,'nullo',trunc(b.data_ora_cessazione),to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select donor_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
file1 := UTL_FILE.fopen(dir_out,'DBC_CESSAZIONINONALLINEATE_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Codice Richiesta; MSISDN richiesta;');
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO msisdn_,idrichiesta_;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,idrichiesta_ ||';'|| msisdn_ ||';');
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
--UTL_FILE.put_line(file1,rs);
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
WHEN others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,72 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
cod varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
cod_op_don varchar2(4);
|
||||
cod_op_rec varchar2(4);
|
||||
descr_stato varchar2(40);
|
||||
data_cut_over_cal DATE;
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_res is
|
||||
select grp.id_richiesta,grp.msisdn, grp.codice_operatore_donating,
|
||||
grp.codice_operatore_recipient,b.descr_stato, grp.data_cut_over
|
||||
from mnp_gestione_richiesta_porting grp,mnp_stato_porting b--,mnp_mss_porting_out c
|
||||
where grp.stato in (3,5)
|
||||
and grp.stato = b.id_stato
|
||||
and grp.data_cut_over <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and grp.data_cut_over >= decode(df,'nullo',grp.data_cut_over,to_date(df,'dd-MON-yy'))
|
||||
group by grp.id_richiesta,codice_operatore_recipient ,grp.msisdn,
|
||||
codice_operatore_donating,grp.codice_operatore_recipient,b.descr_stato, grp.data_cut_over;
|
||||
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out,'MSS_to_DBC_espletamentiinritardoterzeparti_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; MSIDN della richiesta; Codice Operatore Donating; Codice Operatore Recipient; Stato Richiesta; Data Cut-Over Calcolata;');
|
||||
UTL_FILE.put_line (file1,'');
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO cod, msisdn, cod_op_don, cod_op_rec, descr_stato, data_cut_over_cal;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,cod ||';'|| msisdn ||';'|| cod_op_don || ';' || cod_op_rec || ';' || descr_stato ||';'|| data_cut_over_cal || ';');
|
||||
END LOOP;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,89 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
operatore varchar2(10);
|
||||
errore exception;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
DECLARE
|
||||
|
||||
codiceric varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select a.id_richiesta, a.msisdn
|
||||
from mnp_gestione_richiesta a, mnp_gestione_richiesta_cess b
|
||||
where a.msisdn = b.msisdn
|
||||
and a.codice_operatore_recipient = operatore
|
||||
and a.stato = 16
|
||||
and b.stato = 3
|
||||
and b.dataricezionerichiesta <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and b.dataricezionerichiesta >= decode(df,'nullo',b.dataricezionerichiesta,to_date(df,'dd-MON-yy'));
|
||||
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
end if;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, upper(operatore)||'_to_DBC_cessazionilineeportate_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn;');
|
||||
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO codiceric, msisdn;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,codiceric || ';' || msisdn || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
end;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
--when errore then
|
||||
-- DBMS_OUTPUT.PUT_LINE('la data è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,290 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
|
||||
begin
|
||||
/* report_Espletamenti_TIMG.sql
|
||||
|
||||
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='/bea/wlserver6.1/config/mnp/applications/NumberPortability/GUI';
|
||||
end if;
|
||||
1.11.4.1.2.2
|
||||
*/
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATIESPLETAMENTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
-- filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
-- fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'MANCATIESPLETAMENTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
-- UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore(TIMT/TIMG);Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;EsitoEspletamento');
|
||||
|
||||
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'MANCATIESPLETAMENTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient;Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;EsitoEspletamento');
|
||||
|
||||
-- 1.11.4.1.2.2
|
||||
|
||||
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
begin
|
||||
|
||||
--AOM_cod_richiesta := substr(filename,0,5) || AOM_cod_richiesta;
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
--and rownum < 2;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
|
||||
null;
|
||||
END;
|
||||
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 6
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '4'
|
||||
and xo.destinatario = operatore;
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato = 'OK';
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
if (desc_stato= 'ESPLETATA')then
|
||||
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,274 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
|
||||
begin
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATIESPLETAMENTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'MANCATIESPLETAMENTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient;Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;EsitoEspletamento');
|
||||
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
--and rownum < 2;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
|
||||
null;
|
||||
END;
|
||||
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 6
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '4'
|
||||
and xo.destinatario = operatore;
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato = 'OK';
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
if (desc_stato= 'ESPLETATA')then
|
||||
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,76 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
operatore varchar2(10);
|
||||
errore exception;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatore is
|
||||
SELECT desc_olo, recipient_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
BEGIN
|
||||
OPEN cur_operatore;
|
||||
LOOP
|
||||
FETCH cur_operatore INTO operatore, dir_out;
|
||||
EXIT WHEN cur_operatore%NOTFOUND;
|
||||
|
||||
DECLARE
|
||||
cod_richiesta VARCHAR2(23);
|
||||
MSISDN_richiesta VARCHAR2(15);
|
||||
Stato_richiesta VARCHAR2(40);
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
CURSOR cur_ric is
|
||||
select a.id_richiesta,a.msisdn,b.descr_stato
|
||||
from mnp_gestione_richiesta_rec a, mnp_stato_rec b
|
||||
where a.stato in (2,4,6)
|
||||
and a.stato = b.id_stato
|
||||
and a.data_validazione_max <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and codice_operatore_donating = operatore;
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
dir_out:='&2';
|
||||
else
|
||||
di :='&1';
|
||||
|
||||
end if;
|
||||
file1:=UTL_FILE.fopen(dir_out,upper(operatore) || '_to_TIM_VALIDAZIONEGIORNALIERE_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Codice Richiesta;MSISDN della richiesta;Stato Richiesta;');
|
||||
|
||||
OPEN cur_ric;
|
||||
LOOP
|
||||
|
||||
FETCH cur_ric INTO cod_richiesta,MSISDN_richiesta,Stato_richiesta;
|
||||
EXIT WHEN cur_ric%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,cod_richiesta || ';' || MSISDN_richiesta || ';' || Stato_richiesta || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_ric;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
END;
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatore;
|
||||
|
||||
exception
|
||||
when errore then
|
||||
DBMS_OUTPUT.PUT_LINE('La data inserita è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,278 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
richiestaxml varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATENOTIFICHETERZEPARTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
|
||||
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'MANCATENOTIFICHETERZEPARTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient);Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;EsitoEspletamento');
|
||||
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, null, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
--decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
-- controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta_porting r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_recipient =operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
--and rownum < 2;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
--DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
--DBMS_OUTPUT.put_line('niente sql'|| operatore ||'_'|| AOM_cod_richiesta);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta_porting r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 6
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '4'
|
||||
and xo.destinatario = operatore;
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato = 'OK';
|
||||
-- and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
if (desc_stato='ESPLETATA')then
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,276 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
richiestaxml varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATENOTIFICHETERZEPARTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
|
||||
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'MANCATENOTIFICHETERZEPARTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient;Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;EsitoEspletamento');
|
||||
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
begin
|
||||
|
||||
select r.id_richiesta, null, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
--decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
--controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta_porting r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_recipient =operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
--DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
--DBMS_OUTPUT.put_line('niente sql'|| operatore ||'_'|| AOM_cod_richiesta);
|
||||
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta_porting r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 6
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '4'
|
||||
and xo.destinatario = operatore;
|
||||
-- and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato= 'OK';
|
||||
-- and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
if (desc_stato='ESPLETATA')then
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,299 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
flag number(1,0):=0;
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
OPEN cur_operatori;
|
||||
--while ( flag = 1 )
|
||||
-- loop
|
||||
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATEPRESEINCARICO_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
|
||||
|
||||
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'MANCATEPRESEINCARICO_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient;Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;');
|
||||
|
||||
|
||||
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
--ind5 := INSTR (line, ';',1,5);
|
||||
--if (ind5 = 0) then
|
||||
-- ind5 := length(line) +1;
|
||||
--end if;
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
--DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
--AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
-- dbms_output.put_line('richiesta file e....' || AOM_cod_richiesta);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
--substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 5;
|
||||
--and rownum < 2;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
|
||||
null;
|
||||
END;
|
||||
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
--DBMS_OUTPUT.put_line('3');
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
--to_char(xo.data_invio, 'dd-MM-yyyy hh24:mi:ss')
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 5
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '6'
|
||||
and xo.destinatario = operatore;
|
||||
|
||||
--and rownum < 2;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato = 'OK';
|
||||
--and rownum < 2;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
if (desc_stato= 'ESPLETATA')then
|
||||
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
-- dbms_output.put_line('richiesta xml è....' || richiestaxml);
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
end if;
|
||||
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:=0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
-- dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,285 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATEPRESEINCARICO_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
|
||||
|
||||
|
||||
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'MANCATEPRESEINCARICO_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient;Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;');
|
||||
|
||||
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
--ind5 := INSTR (line, ';',1,5);
|
||||
--if (ind5 = 0) then
|
||||
-- ind5 := length(line) +1;
|
||||
--end if;
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
--DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
--AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 5;
|
||||
--and rownum < 2;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
|
||||
null;
|
||||
END;
|
||||
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 5
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '6'
|
||||
and xo.destinatario = operatore;
|
||||
--and rownum < 2;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato = 'OK';
|
||||
--and rownum < 2;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
if (desc_stato= 'ESPLETATA')then
|
||||
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta := conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename);
|
||||
null;
|
||||
|
||||
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,90 @@
|
||||
SET serveroutput on
|
||||
|
||||
|
||||
DECLARE
|
||||
|
||||
operatore varchar2(10);
|
||||
|
||||
errore exception;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
end if;
|
||||
|
||||
OPEN cur_operatori;
|
||||
LOOP
|
||||
|
||||
FETCH cur_operatori INTO operatore;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
DECLARE
|
||||
Codice_richiesta VARCHAR2(23);
|
||||
MSISDN_richiesta VARCHAR2(15);
|
||||
Descr_stato VARCHAR2(40);
|
||||
Data_valid_max DATE;
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
CURSOR cur_ric_val is
|
||||
select a.id_richiesta, a.msisdn, b.descr_stato, a.data_validazione_max
|
||||
from mnp_gestione_richiesta_rec a, mnp_stato_rec b
|
||||
where a.stato in (4,6)
|
||||
and a.stato=b.id_stato
|
||||
and a.data_validazione_max >= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and a.data_validazione_max <= decode(df,'nullo',a.data_validazione_max,to_date(df,'dd-MON-yy'))
|
||||
and a.data_validazione_max <= trunc(sysdate)
|
||||
and a.codice_operatore_donating = operatore;
|
||||
BEGIN
|
||||
file1 := UTL_FILE.fopen (dir_out, upper(operatore)||'_to_TIM_VALIDAZIONEINRITARDO_' || to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
UTL_FILE.put_line (file1,'Codice Richiesta;MSISDN della richiesta;Stato Richiesta;Data di validazione massima;');
|
||||
|
||||
OPEN cur_ric_val;
|
||||
LOOP
|
||||
|
||||
FETCH cur_ric_val INTO Codice_richiesta, MSISDN_richiesta, Descr_stato, Data_valid_max;
|
||||
EXIT WHEN cur_ric_val%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,Codice_richiesta || ';' || MSISDN_richiesta || ';' || Descr_stato || ';' || Data_valid_max || ';');
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_ric_val;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
END;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
when errore then
|
||||
DBMS_OUTPUT.PUT_LINE('La data inserita è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,282 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
--dbms_output.put_line(' dir_out....' ||dir_out||'..............dir_in.........'|| dir_in);
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATEVALIDAZIONI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'MANCATEVALIDAZIONI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient;Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;');
|
||||
|
||||
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
--ind5 := INSTR (line, ';',1,5);
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
-- AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
begin
|
||||
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 2;
|
||||
--and rownum < 2;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
|
||||
null;
|
||||
END;
|
||||
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 2
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '0'
|
||||
and xo.destinatario = operatore;
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato = 'OK';
|
||||
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
if (desc_stato= 'ESPLETATA')then
|
||||
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
-- dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,273 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATEVALIDAZIONI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'MANCATEVALIDAZIONI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
UTL_FILE.put_line (fileout, 'Codice richiesta;MSISDN;Operatore Recipient;Data attesa operazione;Data validazione max;Data Cut-Over Calcolata;Stato Attuale;Id msg XML di TIM;Data/Ora invio;Stato Richiesta;Id msg ACK di AOM;Data/Ora ricezione;');
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
--dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
--ind5 := INSTR (line, ';',1,5);
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
-- AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
|
||||
|
||||
begin
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 2;
|
||||
--and rownum < 2;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
|
||||
null;
|
||||
END;
|
||||
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta ||';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| null ||';'|| null ||';'||'MANCANTE'||';'|| null ||';'|| null || ';'|| null ||';'|| null ||';');
|
||||
ELSE
|
||||
|
||||
desc_stato := '';
|
||||
select s.descr_stato into desc_stato
|
||||
from mnp_stato s
|
||||
where s.id_stato = stato;
|
||||
|
||||
|
||||
id_xml_tim := '';
|
||||
data_xml_tim := '';
|
||||
|
||||
|
||||
begin
|
||||
select xo.nome_file, xo.data_invio
|
||||
into id_xml_tim,data_xml_tim
|
||||
from mnp_xml_out xo, mnp_xml_richiesta_out xro, mnp_gestione_richiesta r
|
||||
where r.id_richiesta = tim_id_richiesta
|
||||
and r.id_richiesta = xro.id_richiesta
|
||||
and xro.nome_file = xo.nome_file
|
||||
and xo.tipo_file = 2
|
||||
and substr(xro.richiestaxml,instr(xro.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1)= '0'
|
||||
and xo.destinatario = operatore;
|
||||
-- and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
begin
|
||||
id_ack_aom := '';
|
||||
data_ack_aom := '';
|
||||
|
||||
select xi.nome_file, xi.data_eff
|
||||
into id_ack_aom, data_ack_aom
|
||||
from mnp_xml_in xi, mnp_xml_ack_in ai
|
||||
where ai.nome_file_riferito = id_xml_tim
|
||||
and ai.nome_file = xi.nome_file
|
||||
and xi.tipo_file=8
|
||||
and ai.risultato = 'OK';
|
||||
--and rownum < 2;
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
null;
|
||||
END;
|
||||
|
||||
if (desc_stato= 'ESPLETATA')then
|
||||
|
||||
desc_stato:='PORTING OK';
|
||||
end if;
|
||||
|
||||
if (richiestaxml = '10') then
|
||||
richiestaxml := 'Sospesa per progetti ad hoc';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '0')then
|
||||
richiestaxml := 'Accettata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '1')then
|
||||
richiestaxml := 'Rifiutata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '2')then
|
||||
richiestaxml := 'Annullata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '3')then
|
||||
richiestaxml := 'sospesa per manutenzione programmata';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '4')then
|
||||
richiestaxml := 'Porting OK';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '5')then
|
||||
richiestaxml := 'Porting KO';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '6')then
|
||||
richiestaxml := 'Presa in carico';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '7')then
|
||||
richiestaxml := 'Scartata Waiting List';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '8')then
|
||||
richiestaxml := 'In OverFlow';
|
||||
else
|
||||
if (substr(richiestaxml,1,1)= '9')then
|
||||
richiestaxml := 'Scartata per codice richiesta duplicato';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
UTL_FILE.put_line (fileout,AOM_cod_richiesta || ';'|| AOM_msisdn ||';'|| operatore ||';'|| AOM_data_attesa ||';'|| data_valid_max ||';'|| data_cut_over ||';'|| desc_stato ||';'|| id_xml_tim ||';'|| data_xml_tim ||';'|| richiestaxml ||';'|| id_ack_aom ||';'|| data_ack_aom || ';'|| AOM_stato ||';');
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,72 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
rs VARCHAR2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_ric is
|
||||
select R.id_richiesta || ';' || R.msisdn || ';' || S.descr_stato || ';' || R.data_cut_over_calc || ';'
|
||||
from mnp_stato_rec S,
|
||||
mnp_gestione_richiesta_rec R
|
||||
where R.espletamentoMss = 0
|
||||
and R.stato in (8,10,11)
|
||||
and R.data_cut_over_AOM <= decode(di,'nullo',trunc(sysdate-1),to_date(di,'dd-MON-yy'))
|
||||
and R.data_cut_over_AOM >= decode(df,'nullo',R.data_cut_over_AOM,to_date(df,'dd-MON-yy'))
|
||||
and S.id_stato = R.stato
|
||||
and r.codice_operatore_donating != 'TIMT'
|
||||
union
|
||||
select R.id_richiesta || ';' || R.msisdn || ';' || S.descr_stato || ';' || R.data_cut_over_calc || ';'
|
||||
from mnp_stato_rec S,
|
||||
mnp_gestione_richiesta_rec R
|
||||
where R.espletamentoMss = 0
|
||||
and R.stato in (8,10,11)
|
||||
and R.data_cut_over_calc <= decode(di,'nullo',trunc(sysdate-1),to_date(di,'dd-MON-yy'))
|
||||
and R.data_cut_over_calc >= decode(df,'nullo',R.data_cut_over_calc,to_date(df,'dd-MON-yy'))
|
||||
and S.id_stato = R.stato
|
||||
and r.codice_operatore_donating = 'TIMT';
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'MSS_to_DBC_attivazioneinRitardo_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,' Codice Richiesta; MSISDN richiesta; Stato Richiesta; Data Cut-Over Calcolata;');
|
||||
OPEN cur_ric;
|
||||
LOOP
|
||||
FETCH cur_ric INTO rs;
|
||||
EXIT WHEN cur_ric%NOTFOUND;
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_ric;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
210
dbcmnpsrc/FE/mnpapp/script/report/sql/report_fc_donor.sql
Normal file
210
dbcmnpsrc/FE/mnpapp/script/report/sql/report_fc_donor.sql
Normal file
@@ -0,0 +1,210 @@
|
||||
SET serveroutput on
|
||||
------------------------------------------------------------
|
||||
-- Report mensile per cessazione linee per MNP - DONOR
|
||||
-- Questo report è a cadenza mensile (schedulato da Crontab)
|
||||
-- e visualizzerà i dati relativi al mese precedente.
|
||||
|
||||
-- Alessia Streglio 28/01/04
|
||||
|
||||
-- Revisione:
|
||||
-- ver. 1.1 02/03/04 Modificato sql per rendere il report
|
||||
-- lanciabile anche da GUI oltre che da
|
||||
-- Crontab. Prende in input 3 parametri:
|
||||
-- p1 : data_inizio_riferimento
|
||||
-- p2 : data_fine_riferimento
|
||||
-- p3 : path UTL File
|
||||
------------------------------------------------------------
|
||||
|
||||
|
||||
DECLARE
|
||||
|
||||
file_output UTL_FILE.file_type; -- dichiaro il file di output
|
||||
file_output_ctr UTL_FILE.file_type; -- dichiaro il file di output di sincronizzazione
|
||||
directory_output varchar2(255); -- directory di output del file
|
||||
rs1 varchar2(255); -- recordset1 utilizzato per scrivere i dati ricavati dalle
|
||||
-- varie query dei cursori
|
||||
rs2 varchar2(255); -- recordset2 utilizzato per scrivere i dati ricavati dalle
|
||||
-- varie query dei cursori
|
||||
rs3 varchar2(255); -- recordset3 utilizzato per scrivere i dati ricavati dalle
|
||||
-- varie query dei cursori
|
||||
mese_anno_riferimento varchar2(10); -- serve per il nome del file es.: 01/2004
|
||||
data_riferimento date; -- serve per calcolarmi il mese precedente
|
||||
data_inizio_riferimento date; -- data inizio di riferimento es.: 01/01/04
|
||||
data_fine_riferimento date; -- data fine di riferimento es.: 31/01/04
|
||||
|
||||
-- per il totale delle richieste per operatore
|
||||
|
||||
operatori varchar2(4);
|
||||
tot_operatore number(6):= 0;
|
||||
|
||||
-- per il dettaglio delle richieste
|
||||
|
||||
appo_msisdn varchar2(15);
|
||||
appo_cod_operatore_recipient varchar2(4);
|
||||
appo_data_ora_cessazione varchar2(20);
|
||||
|
||||
-- appo mi serve per determinare se è stato settato un parametro
|
||||
-- utilizzo 'p1'
|
||||
appo varchar2(15):='&1';
|
||||
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Ricavo il numero totale delle richieste DONOR dove
|
||||
-- la data_cut_over_calc ricade nel mese di riferimento
|
||||
-- e per cui è stato inviato il messaggio di validazione
|
||||
-- (dallo stato 9 in poi ossia --> 9,14,15,16)
|
||||
------------------------------------------------------------
|
||||
CURSOR cur_totale(data_inizio_riferimento date, data_fine_riferimento date) is
|
||||
select b.desc_olo, 0 as count from mnp_olo b
|
||||
where b.flag_terze_parti=1
|
||||
and desc_olo not in
|
||||
(select distinct CODICE_OPERATORE_RECIPIENT
|
||||
from mnp_gestione_richiesta a
|
||||
where a.data_cut_over_calc >= data_inizio_riferimento
|
||||
and a.data_cut_over_calc <= data_fine_riferimento
|
||||
and a.stato in (9,14,15,16))
|
||||
union
|
||||
select a.CODICE_OPERATORE_RECIPIENT, count(*)
|
||||
from mnp_gestione_richiesta a
|
||||
where a.data_cut_over_calc >= data_inizio_riferimento
|
||||
and a.data_cut_over_calc <= data_fine_riferimento
|
||||
and a.stato in (9,14,15,16)
|
||||
group by a.CODICE_OPERATORE_RECIPIENT;
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Ricavo il dettaglio delle richieste DONOR dove
|
||||
-- la data_cut_over_calc ricade nel mese di riferimento
|
||||
-- e per cui è stato inviato il messaggio di validazione (dallo stato 9 in poi ossia --> 9,14,15,16)
|
||||
-- faccio la join sulla tabella mnp_crm_validazione_in perchè la data_cut_over_calc non contiene
|
||||
-- l'ora mentre il campo mnp_crm_validazione_in.data_ora_effettiva_validazione (che riempie data_cut_over_calc)
|
||||
-- è correttamente valorizzato.
|
||||
------------------------------------------------------------
|
||||
CURSOR cur_dettaglio(data_inizio_riferimento date, data_fine_riferimento date) is
|
||||
select a.msisdn, a.CODICE_OPERATORE_RECIPIENT , to_char(b.data_ora_effettiva_validazione,'yyyymmddhh24miss')
|
||||
from mnp_gestione_richiesta a , mnp_crm_validazione_in b
|
||||
where a.data_cut_over_calc >= data_inizio_riferimento
|
||||
and a.data_cut_over_calc <= data_fine_riferimento
|
||||
and a.stato in (9,14,15,16)
|
||||
and a.id_richiesta = b.id_richiesta
|
||||
and b.data_ricezione = (
|
||||
select max(data_ricezione)
|
||||
from mnp_crm_validazione_in c
|
||||
where c.id_richiesta = b.id_richiesta
|
||||
)
|
||||
order by a.CODICE_OPERATORE_RECIPIENT, b.data_ora_effettiva_validazione;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Scrivo il file in formato CSV e CTR(per la sincronizzazione)
|
||||
-----------------------------------------------------------------
|
||||
|
||||
begin
|
||||
|
||||
if (appo <> 'nullo')then -- report lanciato da: Interfaccia Grafica DBC
|
||||
directory_output:='&3';
|
||||
|
||||
-- in questo caso il report parte da GUI ed i parametri sono inseriti
|
||||
-- dall'Utente.
|
||||
|
||||
data_inizio_riferimento := to_date('&1','dd/mm/yyyy');
|
||||
data_fine_riferimento := to_date('&2','dd/mm/yyyy');
|
||||
|
||||
mese_anno_riferimento := to_char( to_date('&1','dd/mm/yyyy'), 'MM-yyyy');
|
||||
|
||||
else -- report lanciato da: Crontab
|
||||
|
||||
/* RU194 il report viene prodotto nella parte di file system che viene replicata sul FE per il download da GUI
|
||||
select ftp_out
|
||||
into directory_output
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'DWH';
|
||||
*/
|
||||
|
||||
select directory_path
|
||||
into directory_output
|
||||
from all_directories
|
||||
where directory_name='DONOR_OUT';
|
||||
|
||||
-- in questo caso il report parte da Crontab senza inserire NESSUN parametro
|
||||
-- ricavo la data di riferimento a partire da sysdate
|
||||
|
||||
data_riferimento := add_months((trunc(sysdate)), -1);
|
||||
mese_anno_riferimento := to_char( add_months((trunc(sysdate)), -1), 'MM-yyyy');
|
||||
|
||||
data_inizio_riferimento := to_date('01/'|| to_char(trunc(data_riferimento), 'MM/yyyy'),'dd/MM/yyyy');
|
||||
data_fine_riferimento := last_day(trunc(data_riferimento));
|
||||
|
||||
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
file_output := UTL_FILE.fopen (directory_output, mese_anno_riferimento || '_DONOR_' || to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
|
||||
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output, mese_anno_riferimento || ' - TIM Donor');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
|
||||
OPEN cur_totale(data_inizio_riferimento, data_fine_riferimento);
|
||||
LOOP
|
||||
FETCH cur_totale INTO operatori,tot_operatore;
|
||||
EXIT WHEN cur_totale%NOTFOUND;
|
||||
UTL_FILE.put_line(file_output,operatori||';' || tot_operatore||';');
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_totale;
|
||||
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output,'MSISDN;' ||'CODICE_OPERATORE_RECIPIENT;'||'DATA_ORA_CESSAZIONE;');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
|
||||
rs1:= '';
|
||||
rs2:= '';
|
||||
rs3:= '';
|
||||
|
||||
OPEN cur_dettaglio(data_inizio_riferimento, data_fine_riferimento);
|
||||
LOOP
|
||||
FETCH cur_dettaglio
|
||||
INTO
|
||||
appo_msisdn,
|
||||
appo_cod_operatore_recipient ,
|
||||
appo_data_ora_cessazione;
|
||||
EXIT WHEN cur_dettaglio%NOTFOUND;
|
||||
|
||||
rs1 := appo_msisdn || ';';
|
||||
rs2 := appo_cod_operatore_recipient || ';';
|
||||
rs3 := appo_data_ora_cessazione || ';';
|
||||
|
||||
UTL_FILE.put_line (file_output, rs1 || rs2 || rs3); --scrivo i risultati del dettaglio
|
||||
END LOOP;
|
||||
CLOSE cur_dettaglio;
|
||||
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose (file_output); -- chiudo il file
|
||||
|
||||
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
file_output_ctr := UTL_FILE.fopen (directory_output, mese_anno_riferimento ||'_DONOR_' || to_char(sysdate,'yyyyMMdd')||'.ctr', 'w');
|
||||
UTL_FILE.fclose (file_output_ctr); -- chiudo il file
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
226
dbcmnpsrc/FE/mnpapp/script/report/sql/report_fc_recipient.sql
Normal file
226
dbcmnpsrc/FE/mnpapp/script/report/sql/report_fc_recipient.sql
Normal file
@@ -0,0 +1,226 @@
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Report mensile per attivazione linee per MNP - RECIPIENT
|
||||
-- Questo report è a cadenza mensile (schedulato da Crontab)
|
||||
-- e visualizzerà i dati relativi al mese precedente.
|
||||
|
||||
-- Alessia Streglio 29/01/04
|
||||
|
||||
-- Revisione:
|
||||
-- ver. 1.1 02/03/04 Modificato sql per rendere il report
|
||||
-- lanciabile anche da GUI oltre che da
|
||||
-- Crontab. Prende in input 3 parametri:
|
||||
-- p1 : data_inizio_riferimento
|
||||
-- p2 : data_fine_riferimento
|
||||
-- p3 : path UTL File
|
||||
------------------------------------------------------------
|
||||
|
||||
set serveroutput on size 1000000
|
||||
DECLARE
|
||||
|
||||
|
||||
file_output UTL_FILE.file_type; -- dichiaro il file di output
|
||||
file_output_ctr UTL_FILE.file_type; -- dichiaro il file di output di sincronizzazione
|
||||
directory_output varchar2(255); -- directory di output del file
|
||||
|
||||
mese_anno_riferimento varchar2(10); -- serve per il nome del file es.: 01/2004
|
||||
data_riferimento date; -- serve per calcolarmi il mese precedente
|
||||
data_inizio_riferimento date; -- data inizio di riferimento es.: 01/01/04
|
||||
data_fine_riferimento date; -- data fine di riferimento es.: 31/01/04
|
||||
|
||||
-- per il totale delle richieste per operatore
|
||||
|
||||
operatori varchar2(4);
|
||||
tot_operatore number(6):= 0;
|
||||
|
||||
-- per il dettaglio delle richieste
|
||||
|
||||
appo_id_richiesta varchar2(23);
|
||||
appo_cod_operatore_donating varchar2(4);
|
||||
appo_msisdn varchar2(15);
|
||||
appo_data_cut_over_aom varchar2(20);
|
||||
|
||||
-- appo mi serve per determinare se è stato settato un parametro
|
||||
-- utilizzo 'p1'
|
||||
appo varchar2(15):='&1';
|
||||
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- Ricavo il numero totale delle richieste RECIPIENT
|
||||
-- per cui è arrivato il file di espletamento
|
||||
-- nel mese/anno di riferimento
|
||||
-------------------------------------------------------------------------
|
||||
-- modifica di Giovanni Gambale/Ida Capone Braga (10/08/2004)
|
||||
CURSOR cur_totale(data_inizio_riferimento date, data_fine_riferimento date) is
|
||||
SELECT desc_olo, max(conta) FROM
|
||||
(SELECT desc_olo desc_olo, 0 conta
|
||||
FROM mnp_olo
|
||||
WHERE flag_terze_parti = 1
|
||||
UNION
|
||||
SELECT gr.codice_operatore_donating desc_olo, count(*) conta
|
||||
FROM mnp_gestione_richiesta_rec gr
|
||||
where id_richiesta in (
|
||||
SELECT distinct(gr.id_richiesta)
|
||||
FROM mnp_gestione_richiesta_rec gr, mnp_xml_in xi, mnp_xml_richiesta_in xin
|
||||
WHERE gr.id_richiesta=xin.id_richiesta
|
||||
AND xin.nome_file=xi.nome_file
|
||||
AND gr.stato in (8,10,11,12)
|
||||
AND gr.espletamentodonating = 1
|
||||
AND gr.codice_operatore_donating = xi.mittente
|
||||
AND xi.tipo_file = 6
|
||||
AND xi.data_eff >= data_inizio_riferimento
|
||||
AND xi.data_eff < data_fine_riferimento + 1
|
||||
)
|
||||
GROUP BY gr.codice_operatore_donating
|
||||
)
|
||||
GROUP BY desc_olo;
|
||||
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- Ricavo il dettaglio delle richieste RECIPIENT
|
||||
-- per cui è arrivato il file di espletamento
|
||||
-- nel mese/anno di riferimento
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
CURSOR cur_dettaglio(data_inizio_riferimento date, data_fine_riferimento date) is
|
||||
SELECT gr.id_richiesta, gr.codice_operatore_donating, gr.msisdn
|
||||
FROM mnp_gestione_richiesta_rec gr
|
||||
where id_richiesta in (
|
||||
SELECT distinct(gr.id_richiesta)
|
||||
FROM mnp_gestione_richiesta_rec gr, mnp_xml_in xi, mnp_xml_richiesta_in xin
|
||||
WHERE gr.id_richiesta=xin.id_richiesta
|
||||
AND xin.nome_file=xi.nome_file
|
||||
AND gr.stato in (8,10,11,12)
|
||||
AND gr.espletamentodonating = 1
|
||||
AND gr.codice_operatore_donating = xi.mittente
|
||||
AND xi.tipo_file = 6
|
||||
AND xi.data_eff >= data_inizio_riferimento
|
||||
AND xi.data_eff < data_fine_riferimento + 1
|
||||
)
|
||||
ORDER BY gr.codice_operatore_donating;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Scrivo il file in formato CSV e CTR(per la sincronizzazione)
|
||||
-----------------------------------------------------------------
|
||||
begin
|
||||
|
||||
|
||||
if (appo <> 'nullo') then -- report lanciato da: Interfaccia Grafica DBC
|
||||
directory_output:='&3';
|
||||
|
||||
-- in questo caso il report parte da GUI ed i parametri sono inseriti
|
||||
-- dall'Utente.
|
||||
|
||||
data_inizio_riferimento := to_date('&1','dd/mm/yyyy');
|
||||
data_fine_riferimento := to_date('&2','dd/mm/yyyy');
|
||||
|
||||
mese_anno_riferimento := to_char( to_date('&1','dd/mm/yyyy'), 'MM-yyyy');
|
||||
|
||||
else -- report lanciato da: Crontab
|
||||
|
||||
/* RU194 il report viene prodotto nella parte di file system che viene replicata sul FE per il download da GUI
|
||||
select ftp_out
|
||||
into directory_output
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'DWH';
|
||||
*/
|
||||
|
||||
select directory_path
|
||||
into directory_output
|
||||
from all_directories
|
||||
where directory_name='RECIPIENT_OUT';
|
||||
|
||||
-- in questo caso il report parte da Crontab senza inserire NESSUN parametro
|
||||
-- ricavo la data di riferimento a partire da sysdate
|
||||
|
||||
data_riferimento := add_months((trunc(sysdate)), -1);
|
||||
mese_anno_riferimento := to_char( add_months((trunc(sysdate)), -1), 'MM-yyyy');
|
||||
|
||||
data_inizio_riferimento := to_date('01/'|| to_char(trunc(data_riferimento), 'MM/yyyy'),'dd/MM/yyyy');
|
||||
data_fine_riferimento := last_day(trunc(data_riferimento));
|
||||
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
file_output := UTL_FILE.fopen (directory_output, mese_anno_riferimento || '_RECIPIENT_' || to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
DBMS_OUTPUT.PUT_LINE('ERRORE: '||sqlerrm);
|
||||
END;
|
||||
|
||||
begin
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output, mese_anno_riferimento || ' - TIM Recipient');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
|
||||
OPEN cur_totale(data_inizio_riferimento, data_fine_riferimento);
|
||||
LOOP
|
||||
FETCH cur_totale INTO operatori,tot_operatore;
|
||||
EXIT WHEN cur_totale%NOTFOUND;
|
||||
UTL_FILE.put_line(file_output,operatori ||';' || tot_operatore||';');
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_totale;
|
||||
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output,'ID RICHIESTA;' ||'CODICE_OPERATORE_DONATING;'||'MSISDN;' ||'DATA_CUT_OVER_AOM;');
|
||||
UTL_FILE.put_line (file_output,' ');
|
||||
|
||||
|
||||
OPEN cur_dettaglio(data_inizio_riferimento, data_fine_riferimento);
|
||||
LOOP
|
||||
FETCH cur_dettaglio
|
||||
INTO
|
||||
appo_id_richiesta,
|
||||
appo_cod_operatore_donating,
|
||||
appo_msisdn;
|
||||
EXIT WHEN cur_dettaglio%NOTFOUND;
|
||||
|
||||
begin
|
||||
select to_char(xi.data_eff,'yyyymmddhh24miss')
|
||||
into appo_data_cut_over_aom
|
||||
FROM mnp_gestione_richiesta_rec gr, mnp_xml_in xi, mnp_xml_richiesta_in xin
|
||||
WHERE gr.id_richiesta=xin.id_richiesta
|
||||
AND xin.nome_file=xi.nome_file
|
||||
AND gr.id_richiesta = appo_id_richiesta
|
||||
AND gr.codice_operatore_donating = xi.mittente
|
||||
AND xi.tipo_file = 6
|
||||
AND xi.data_eff >= data_inizio_riferimento
|
||||
AND xi.data_eff < data_fine_riferimento + 1
|
||||
AND rownum<2
|
||||
order by xi.data_eff;
|
||||
exception when no_data_found then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm||' Non trovata data_eff per '||appo_id_richiesta );
|
||||
end;
|
||||
UTL_FILE.put_line(file_output,appo_id_richiesta ||';' || appo_cod_operatore_donating ||';' || appo_msisdn ||';' || appo_data_cut_over_aom ||';' ); --scrivo i risultati del dettaglio
|
||||
END LOOP;
|
||||
CLOSE cur_dettaglio;
|
||||
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose (file_output); -- chiudo il file
|
||||
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
file_output_ctr := UTL_FILE.fopen (directory_output, mese_anno_riferimento ||'_RECIPIENT_' || to_char(sysdate,'yyyyMMdd')||'.ctr', 'w');
|
||||
UTL_FILE.fclose (file_output_ctr); -- chiudo il file
|
||||
end;
|
||||
/
|
||||
exit;
|
||||
|
||||
182
dbcmnpsrc/FE/mnpapp/script/report/sql/report_per_Sla.sql
Normal file
182
dbcmnpsrc/FE/mnpapp/script/report/sql/report_per_Sla.sql
Normal file
@@ -0,0 +1,182 @@
|
||||
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
file1 UTL_FILE.file_type;
|
||||
operatore VARCHAR2(10);
|
||||
tot1 INTEGER(8);
|
||||
tot2 INTEGER(8);
|
||||
tot3 INTEGER(8);
|
||||
tot4 INTEGER(8);
|
||||
validatemenodieci INTEGER(8);
|
||||
validatepiudieci INTEGER(8);
|
||||
attivatemenodieci INTEGER(8);
|
||||
attivatepiudieci INTEGER(8);
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
data_pivot_ date;
|
||||
gg_lav_ number(03):=0;
|
||||
num number(15):=0;
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select aom_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
|
||||
select data_pivot, gg_lav
|
||||
into data_pivot_, gg_lav_
|
||||
from mnp_data_report;
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out,'DBC_to_SU_' || to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
tot1 := 0;
|
||||
tot2 := 0;
|
||||
tot3 := 0;
|
||||
tot4 := 0;
|
||||
UTL_FILE.put_line(file1,'DONATING;Validazioni in ritardo; ;Attivazioni in ritardo; ');
|
||||
UTL_FILE.put_line(file1,';1-5gg.;>5gg.;1-5gg.;>5gg.;');
|
||||
|
||||
OPEN cur_operatori;
|
||||
LOOP
|
||||
|
||||
FETCH cur_operatori INTO operatore;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
select sum(a.num) into validatemenodieci
|
||||
from
|
||||
(
|
||||
SELECT count(*)num
|
||||
FROM mnp_gestione_richiesta_rec
|
||||
WHERE dataricezionerichiesta < data_pivot_
|
||||
and codice_operatore_donating = operatore
|
||||
AND stato in (7,9,8,10,11,12,14)
|
||||
AND trunc(data_validazione_eff) BETWEEN (data_validazione_max+1) AND (data_validazione_max + 10)
|
||||
and trunc(data_validazione_eff) <= decode(di,'nullo',trunc(data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(data_validazione_eff) >= decode(df,'nullo',trunc(data_validazione_eff),to_date(df,'dd-MON-yy'))
|
||||
union all
|
||||
SELECT count(*)num
|
||||
FROM mnp_gestione_richiesta_rec
|
||||
WHERE dataricezionerichiesta >= data_pivot_
|
||||
and codice_operatore_donating = operatore
|
||||
AND stato in (7,9,8,10,11,12,14)
|
||||
AND trunc(data_validazione_eff) BETWEEN (data_validazione_max+1) AND (data_validazione_max + gg_lav_)
|
||||
and trunc(data_validazione_eff) <= decode(di,'nullo',trunc(data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(data_validazione_eff) >= decode(df,'nullo',trunc(data_validazione_eff),to_date(df,'dd-MON-yy'))
|
||||
)a;
|
||||
|
||||
|
||||
select sum(b.num) INTO validatepiudieci
|
||||
from
|
||||
(
|
||||
SELECT count(*) num
|
||||
FROM mnp_gestione_richiesta_rec
|
||||
WHERE dataricezionerichiesta < data_pivot_
|
||||
and codice_operatore_donating = operatore
|
||||
AND stato in (7,9,8,10,11,12,14)
|
||||
AND trunc(data_validazione_eff) > data_validazione_max + 10
|
||||
and trunc(data_validazione_eff) <= decode(di,'nullo',trunc(data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(data_validazione_eff) >= decode(df,'nullo',trunc(data_validazione_eff),to_date(df,'dd-MON-yy'))
|
||||
union all
|
||||
SELECT count(*) num
|
||||
FROM mnp_gestione_richiesta_rec
|
||||
WHERE dataricezionerichiesta >= data_pivot_
|
||||
and codice_operatore_donating = operatore
|
||||
AND stato in (7,9,8,10,11,12,14)
|
||||
AND trunc(data_validazione_eff) > (data_validazione_max + gg_lav_)
|
||||
and trunc(data_validazione_eff) <= decode(di,'nullo',trunc(data_validazione_eff),to_date(di,'dd-MON-yy'))
|
||||
and trunc(data_validazione_eff) >= decode(df,'nullo',trunc(data_validazione_eff),to_date(df,'dd-MON-yy'))
|
||||
)b;
|
||||
|
||||
select sum(c.num)into attivatemenodieci
|
||||
from
|
||||
(
|
||||
select count(*) num
|
||||
from mnp_gestione_richiesta_rec r, mnp_xml_in i, mnp_xml_richiesta_in ri
|
||||
where r.id_richiesta = ri.id_richiesta
|
||||
and ri.nome_file = i.nome_file
|
||||
and i.tipo_file = 6
|
||||
and operatore = substr(ri.nome_file, 0,4)
|
||||
and r.dataricezionerichiesta < data_pivot_
|
||||
AND data_cut_over_aom BETWEEN (data_cut_over_calc+1) AND (data_cut_over_calc + 10)
|
||||
and data_cut_over_aom <= decode(di,'nullo',data_cut_over_aom,to_date(di,'dd-MON-yy'))
|
||||
and data_cut_over_aom >= decode(df,'nullo',data_cut_over_aom,to_date(df,'dd-MON-yy'))
|
||||
union all
|
||||
select count(*)num
|
||||
from mnp_gestione_richiesta_rec r, mnp_xml_in i, mnp_xml_richiesta_in ri
|
||||
where r.id_richiesta = ri.id_richiesta
|
||||
and ri.nome_file = i.nome_file
|
||||
and i.tipo_file = 6
|
||||
and operatore = substr(ri.nome_file, 0,4)
|
||||
and r.dataricezionerichiesta >= data_pivot_
|
||||
AND data_cut_over_aom BETWEEN data_cut_over_calc+1 AND data_cut_over_calc + gg_lav_
|
||||
and data_cut_over_aom <= decode(di,'nullo',data_cut_over_aom,to_date(di,'dd-MON-yy'))
|
||||
and data_cut_over_aom >= decode(df,'nullo',data_cut_over_aom,to_date(df,'dd-MON-yy'))
|
||||
)c;
|
||||
|
||||
select sum(d.num) INTO attivatepiudieci
|
||||
from
|
||||
(
|
||||
SELECT count(*) num
|
||||
FROM mnp_gestione_richiesta_rec r, mnp_xml_in i, mnp_xml_richiesta_in ri
|
||||
WHERE r.id_richiesta = ri.id_richiesta
|
||||
and ri.nome_file = i.nome_file
|
||||
and i.tipo_file = 6
|
||||
and operatore = substr(ri.nome_file, 0,4)
|
||||
and r.dataricezionerichiesta < data_pivot_
|
||||
AND data_cut_over_aom> data_cut_over_calc + 10
|
||||
and data_cut_over_aom <= decode(di,'nullo',data_cut_over_aom,to_date(di,'dd-MON-yy'))
|
||||
and data_cut_over_aom >= decode(df,'nullo',data_cut_over_aom,to_date(df,'dd-MON-yy'))
|
||||
union all
|
||||
SELECT count(*) num
|
||||
FROM mnp_gestione_richiesta_rec r, mnp_xml_in i, mnp_xml_richiesta_in ri
|
||||
WHERE r.id_richiesta = ri.id_richiesta
|
||||
and ri.nome_file = i.nome_file
|
||||
and i.tipo_file = 6
|
||||
and operatore = substr(ri.nome_file, 0,4)
|
||||
and r.dataricezionerichiesta >= data_pivot_
|
||||
AND data_cut_over_aom > data_cut_over_calc + gg_lav_
|
||||
and data_cut_over_aom <= decode(di,'nullo',data_cut_over_aom,to_date(di,'dd-MON-yy'))
|
||||
and data_cut_over_aom >= decode(df,'nullo',data_cut_over_aom,to_date(df,'dd-MON-yy'))
|
||||
)d;
|
||||
|
||||
|
||||
|
||||
tot1 := tot1 + validatemenodieci;
|
||||
tot2 := tot2 + validatepiudieci;
|
||||
tot3 := tot3 + attivatemenodieci;
|
||||
tot4 := tot4 + attivatepiudieci;
|
||||
|
||||
UTL_FILE.put_line(file1,operatore || ';' || validatemenodieci || ';' || validatepiudieci || ';' || attivatemenodieci || ';' || attivatepiudieci || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
UTL_FILE.put_line(file1,'TOTALE' || ';' || tot1 || ';' || tot2 || ';' || tot3 || ';' || tot4 || ';');
|
||||
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
dbms_output.put_line(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,57 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs Varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_rec is
|
||||
select r.id_richiesta || ';' || a.msisdn || ';' || a.causale_scarto || ';'
|
||||
from mnp_mss_scarti_in a, mnp_gestione_richiesta r
|
||||
where trunc(to_date(a.data_inserimento,'dd-MON-yy')) <= decode(di,'nullo',trunc(sysdate-1),to_date(di,'dd-MON-yy'))
|
||||
and trunc(to_date(a.data_inserimento,'dd-MON-yy')) >= decode(df,'nullo',trunc(to_date(a.data_inserimento,'dd-MON-yy')),to_date(df,'dd-MON-yy'))
|
||||
and r.msisdn = a.msisdn;
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'MSS_to_DBC_ATTIVAZIONE_' || to_char(sysdate,'yyyyMMdd')|| '.csv','w');
|
||||
UTL_FILE.put_line(file1,'Codice Richiesta; MSISDN della richiesta; Motivo dello scarto;');
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO rs;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,55 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs Varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_rec is
|
||||
select s.cod_richiesta || ';' || s.prefisso_olo||s.numero_olo || ';' || s.cod_fis_cli_olo || ';' || s.causale_scarto || ';'
|
||||
from mnp_bit_scarti_in s
|
||||
where s.data_inserimento <= decode(di,'nullo',trunc(sysdate-1),to_date(di,'dd-MON-yy'))
|
||||
and s.data_inserimento >= decode(df,'nullo',s.data_inserimento,to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
end if;
|
||||
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'BIT_to_DBC_ACQUISIZIONERICHIESTA_' || to_char(sysdate,'yyyyMMdd')|| '.csv','w');
|
||||
UTL_FILE.put_line(file1,'Codici richiesta di porting-in; msisdn richiesta; Codice Fiscale; Motivo scarto;');
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO rs;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,139 @@
|
||||
set serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs varchar2(255);
|
||||
nome_file varchar2(255);
|
||||
operatore_don varchar2(255);
|
||||
id_richiesta_ varchar2(255);
|
||||
err_msg varchar2(255);
|
||||
msisdn varchar2(255);
|
||||
risultato varchar2(255);
|
||||
conta integer(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
-- fare la query con la UNION
|
||||
CURSOR cur_rec_noack is
|
||||
select distinct o.nome_file , r.codice_operatore_donating , null , r.id_richiesta , r.msisdn
|
||||
from mnp_xml_out o, mnp_gestione_richiesta_rec r, mnp_xml_richiesta_out ao
|
||||
where o.tipo_file = 1
|
||||
and o.da_inviare = 2
|
||||
and o.nome_file = ao.nome_file
|
||||
and ao.id_richiesta = r.id_richiesta;
|
||||
|
||||
|
||||
CURSOR cur_rec_ack_ko is
|
||||
/*select
|
||||
distinct o.nome_file ,r.codice_operatore_donating, ai.err_msg , r.id_richiesta , r.msisdn
|
||||
from mnp_xml_out o, mnp_gestione_richiesta_rec r, mnp_xml_richiesta_out ao, mnp_xml_ack_in ai, mnp_xml_in i
|
||||
where r.id_richiesta = ao.id_richiesta
|
||||
and ao.nome_file = o.nome_file
|
||||
and o.tipo_file = 1
|
||||
and o.nome_file = ai.nome_file_riferito
|
||||
and ai.risultato = 'ERROR'
|
||||
and i.nome_file = ai.nome_file
|
||||
and i.tipo_file = 8
|
||||
and trunc(i.data_eff) <= trunc(sysdate);*/
|
||||
|
||||
|
||||
select
|
||||
distinct o.nome_file , ai.err_msg , ao.id_richiesta
|
||||
from mnp_xml_out o, mnp_xml_richiesta_out ao, mnp_xml_ack_in ai, mnp_xml_in i
|
||||
where ao.nome_file = o.nome_file
|
||||
and o.tipo_file = 1
|
||||
and o.nome_file = ai.nome_file_riferito
|
||||
and ai.risultato = 'ERROR'
|
||||
and i.nome_file = ai.nome_file
|
||||
and i.tipo_file = 8
|
||||
and trunc(i.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(i.data_eff) >= decode(df,'nullo',trunc(i.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'DONATING_to_TIM_AckKOInvioRichiestaAttivazione_' || to_char(sysdate,'yyyyMMdd')||'.csv','w');
|
||||
UTL_FILE.put_line(file1,'Nome file Invio Richiesta; Codice operatore Donating ;Codice Richiesta; Messaggio errore ACK KO ; MSISDN ');
|
||||
|
||||
conta := 0;
|
||||
OPEN cur_rec_ack_ko;
|
||||
LOOP
|
||||
|
||||
FETCH cur_rec_ack_ko INTO nome_file,err_msg, id_richiesta_;
|
||||
EXIT WHEN cur_rec_ack_ko%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
select count(nome_file_riferito) into conta
|
||||
from mnp_xml_ack_out
|
||||
where nome_file_riferito = nome_file
|
||||
and risultato != 'ERROR';
|
||||
|
||||
|
||||
if (conta = 0)then
|
||||
begin
|
||||
|
||||
select r.codice_operatore_donating, r.msisdn
|
||||
into operatore_don,msisdn
|
||||
from mnp_gestione_richiesta_rec r
|
||||
where id_richiesta = id_richiesta_;
|
||||
|
||||
|
||||
|
||||
UTL_FILE.put_line(file1,nome_file ||';'|| operatore_don ||';'|| id_richiesta_ ||';'|| err_msg ||';'|| msisdn);
|
||||
exception when no_data_found then
|
||||
DBMS_OUTPUT.PUT_LINE('id_rcihciesta'||id_richiesta_);
|
||||
id_richiesta_ := null;
|
||||
end;
|
||||
|
||||
else
|
||||
conta:= 0;
|
||||
end if;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_rec_ack_ko;
|
||||
nome_file := '';
|
||||
operatore_don:= '';
|
||||
id_richiesta_:= '';
|
||||
err_msg:= '';
|
||||
msisdn:= '';
|
||||
|
||||
OPEN cur_rec_noack;
|
||||
LOOP
|
||||
FETCH cur_rec_noack INTO nome_file, operatore_don, id_richiesta_,err_msg,msisdn;
|
||||
EXIT WHEN cur_rec_noack%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,nome_file ||';'|| operatore_don ||';'|| id_richiesta_ ||';'|| err_msg ||';'|| msisdn);
|
||||
END LOOP;
|
||||
CLOSE cur_rec_noack;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,114 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
nome_file Varchar2(50);
|
||||
cod_operatore_donating Varchar2(4);
|
||||
error_msg Varchar2(128);
|
||||
id_richiesta Varchar2(23);
|
||||
msisdn Varchar2(16);
|
||||
conta integer(5);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out Varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
CURSOR cur_rec_ack_ko is
|
||||
SELECT distinct xo.nome_file, gr.codice_operatore_donating, xai.err_msg, gr.id_richiesta, gr.msisdn
|
||||
FROM mnp_gestione_richiesta_rec gr,
|
||||
mnp_xml_richiesta_out ro,
|
||||
mnp_xml_out xo,
|
||||
mnp_xml_in xi,
|
||||
mnp_xml_ack_in xai
|
||||
WHERE gr.id_richiesta = ro.id_richiesta
|
||||
AND ro.nome_file = xo.nome_file
|
||||
AND xo.tipo_file = 3
|
||||
AND xo.nome_file = xai.nome_file_riferito
|
||||
AND xai.risultato = 'ERROR'
|
||||
AND xai.nome_file = xi.nome_file
|
||||
AND xi.tipo_file = 8
|
||||
and trunc(xi.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(xi.data_eff) >= decode(df,'nullo',trunc(xi.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
CURSOR cur_rec_noack is
|
||||
|
||||
SELECT distinct xo.nome_file , gr.codice_operatore_donating, null, gr.id_richiesta, gr.msisdn
|
||||
FROM mnp_gestione_richiesta_rec gr,
|
||||
mnp_xml_richiesta_out ro,
|
||||
mnp_xml_out xo
|
||||
WHERE gr.id_richiesta = ro.id_richiesta
|
||||
AND ro.nome_file = xo.nome_file
|
||||
AND xo.tipo_file = 3
|
||||
and xo.da_inviare = 2;
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select aom_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
file1:= UTL_FILE.fopen(dir_out,'AOM_to_TIM_AckKONotifichePortingTerzi_' || to_char(sysdate,'yyyyMMdd')|| '.csv','w');
|
||||
UTL_FILE.put_line(file1,'Nome file Notifiche Porting Terzi; Codice operatore AOM; Messaggio di errore; Codice richiesta; MSISDN');
|
||||
conta :=0;
|
||||
OPEN cur_rec_ack_ko;
|
||||
LOOP
|
||||
FETCH cur_rec_ack_ko INTO nome_file,cod_operatore_donating,error_msg,id_richiesta, msisdn;
|
||||
EXIT WHEN cur_rec_ack_ko%NOTFOUND;
|
||||
|
||||
|
||||
select count(nome_file_riferito) into conta
|
||||
from mnp_xml_ack_out
|
||||
where nome_file_riferito = nome_file
|
||||
and risultato != 'ERROR';
|
||||
|
||||
if (conta = 0)then
|
||||
UTL_FILE.put_line(file1,nome_file || ';' || cod_operatore_donating || ';' || error_msg || ';' || id_richiesta ||';' || msisdn || ';');
|
||||
else
|
||||
conta := 0;
|
||||
end if;
|
||||
--UTL_FILE.put_line(file1,nome_file || ';' || cod_operatore_donating || ';' || error_msg || ';' || id_richiesta ||';' || msisdn || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_rec_ack_ko;
|
||||
|
||||
nome_file:= '';
|
||||
cod_operatore_donating:= '';
|
||||
error_msg:='';
|
||||
id_richiesta:='';
|
||||
msisdn:= '';
|
||||
|
||||
open cur_rec_noack;
|
||||
LOOP
|
||||
FETCH cur_rec_noack INTO nome_file,cod_operatore_donating,error_msg,id_richiesta, msisdn;
|
||||
EXIT WHEN cur_rec_noack%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line(file1,nome_file || ';' || cod_operatore_donating || ';' || error_msg || ';' || id_richiesta ||';' || msisdn || ';');
|
||||
END LOOP;
|
||||
CLOSE cur_rec_noack;
|
||||
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fClose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
95
dbcmnpsrc/FE/mnpapp/script/report/sql/report_scartiSid.sql
Normal file
95
dbcmnpsrc/FE/mnpapp/script/report/sql/report_scartiSid.sql
Normal file
@@ -0,0 +1,95 @@
|
||||
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
rs VARCHAR2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_rec is
|
||||
select s.prefisso_aom || s.num_tel_aom || ';' || s.codice_fiscale || ';' ||
|
||||
decode(s.esito,01,'Formato Prefisso Tim non numerico',
|
||||
02,'Prefisso o Telefono TIM errati',
|
||||
03,'Valore Prefisso AOM errato',
|
||||
04,'Formato Numero AOM errato',
|
||||
05,'Formato ICCD errato',
|
||||
06,'Formato Partita IVA errato',
|
||||
07,'Valore Codice Pre-Post pagato errato',
|
||||
08,'Formato Data Cut Over errata',
|
||||
12,'Valore Tipo Documento errato',
|
||||
13,'Formato Numero Documento errato',
|
||||
14,'Formato Data richiesta errato',
|
||||
17,'Formato IMSI Errato',
|
||||
18,'Valore Codice operatore donating errato',
|
||||
19,'Formato Codice Fiscale Errato',
|
||||
20,'Codice fiscale o Partiva IVA nulli',
|
||||
21,'Cognome o nome o denominazione società nulli',
|
||||
22,'Valore Tipo operazione o Valore Tecnologia errati',
|
||||
25,'Lunghezza record errata',
|
||||
32,'Presenza di caratteri speciali',
|
||||
34,'Codice operatore nullo',
|
||||
35,'Prefisso AOM nullo',
|
||||
36,'Numero AOM nullo',
|
||||
37,'ICCID nullo',
|
||||
38,'Codice pre_post_pagato nullo',
|
||||
39,'Data cut over nulla',
|
||||
40,'Cognome nullo(ragione sociale non nulla)',
|
||||
41,'Nome nullo',
|
||||
42,'Tipo documento nullo',
|
||||
43,'Numero documento nullo',
|
||||
44,'Data richiesta nulla',
|
||||
45,'Tipo operazione nullo',
|
||||
46,'Tecnologia nulla',
|
||||
47,'IMSI nullo',
|
||||
48,'Valore subsys errato',
|
||||
49,'Prefisso o numero TIM nulli',
|
||||
50,'Prefisso o Telefono TIM errati') || ';'
|
||||
from mnp_sid_scarti_in s
|
||||
where trunc(data_inserimento) <= decode(di,'nullo',trunc(sysdate-1),to_date(di,'dd-MON-yy'))
|
||||
and trunc(data_inserimento) >= decode(df,'nullo',trunc(data_inserimento),to_date(df,'dd-MON-yy'));
|
||||
--where trunc(to_date(s.data_richiesta,'yyyyMMddhh24miss')) = trunc(sysdate-1);
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 2 è ....' || dir_out );
|
||||
end if;
|
||||
|
||||
|
||||
|
||||
file1:=UTL_FILE.fopen(dir_out,'SID_to_DBC_ACQUISIZIONERICHIESTA_' || to_char(sysdate,'yyyyMMdd')|| '.csv','w');
|
||||
UTL_FILE.put_line(file1,'Msisdn richiesta; Codice Fiscale; Motivo dello scarto;');
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO rs;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
UTL_FILE.put_line(file1,rs);
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,86 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
nome_file_ack Varchar2(50);
|
||||
cod_operatore_donating Varchar2(4);
|
||||
nome_file_val Varchar2(50);
|
||||
msg_err Varchar2(128);
|
||||
file1 UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
conta integer(5);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_rec is
|
||||
select distinct AO.nome_file, R.codice_operatore_donating, I.nome_file, AO.ERRMSG
|
||||
from mnp_xml_ack_out AO,
|
||||
mnp_xml_in I,
|
||||
mnp_xml_richiesta_in IR,
|
||||
mnp_gestione_richiesta_rec R,
|
||||
mnp_xml_out XO
|
||||
where AO.risultato = 'ERROR'
|
||||
and AO.nome_file_riferito=I.nome_file
|
||||
and I.tipo_file=2
|
||||
and I.nome_file=IR.nome_file
|
||||
and IR.id_richiesta = R.id_richiesta
|
||||
and AO.nome_file = XO.nome_file
|
||||
and XO.tipo_file = 8
|
||||
and trunc(XO.data_eff) <= decode(di,'nullo',trunc(sysdate),to_date(di,'dd-MON-yy'))
|
||||
and trunc(XO.data_eff) >= decode(df,'nullo',trunc(XO.data_eff),to_date(df,'dd-MON-yy'));
|
||||
|
||||
BEGIN
|
||||
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
--DBMS_OUTPUT.PUT_LINE('dir_out 1 è ....' || dir_out );
|
||||
|
||||
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
end if;
|
||||
|
||||
|
||||
file1:= UTL_FILE.fopen(dir_out,'TIM_to_DONATING_AckKOValidazione_' || to_char(sysdate,'yyyyMMdd')|| '.csv','w');
|
||||
UTL_FILE.put_line(file1,'Nome file ACK KO; Codice operatore Donating; Nome file di Validazione; Messaggio di errore;');
|
||||
conta := 0;
|
||||
|
||||
OPEN cur_rec;
|
||||
LOOP
|
||||
FETCH cur_rec INTO nome_file_ack, cod_operatore_donating, nome_file_val, msg_err;
|
||||
EXIT WHEN cur_rec%NOTFOUND;
|
||||
|
||||
select count(nome_file_riferito)into conta
|
||||
from mnp_xml_ack_out
|
||||
where nome_file_riferito = nome_file_val
|
||||
and risultato != 'ERROR';
|
||||
|
||||
if (conta = 0) then
|
||||
|
||||
UTL_FILE.put_line(file1,nome_file_ack || ';' || cod_operatore_donating || ';' || nome_file_val || ';' || msg_err || ';');
|
||||
else
|
||||
conta :=0;
|
||||
end if;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur_rec;
|
||||
UTL_FILE.fflush(file1);
|
||||
UTL_FILE.fclose(file1);
|
||||
|
||||
exception
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,238 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
--read_error exception;
|
||||
--write_error exception;
|
||||
--invalid_path exception;
|
||||
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in,donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATIESPLETAMENTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'SINTESIMANCATIESPLETAMENTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
--DBMS_OUTPUT.put_line('...creati.');
|
||||
-- dbms_output.put_line('i campi sono.... operatore... ' || AOM_op || '....AOM_msisdn ....' || AOM_msisdn || '....AOM_data_attesa....' || AOM_data_attesa ||'.....AOM_cod_richiesta.....>'||AOM_cod_richiesta||'<');
|
||||
-- dbms_output.put_line('.....AOM_cod_richiesta.....>'|| AOM_cod_richiesta||'<');
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('2 e id richiesta tim è....' || tim_id_richiesta || '.......'|| 'stato....'||stato);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
count_mancanti := count_mancanti + 1;
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore:, ' || ';'||operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate espletamenti: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' ||';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' ||';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' ||';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate: ' ||';'|| count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' ||';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' ||';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' ||';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'Porting OK: ' ||';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,239 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
--read_error exception;
|
||||
--write_error exception;
|
||||
--invalid_path exception;
|
||||
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in,donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATIESPLETAMENTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'SINTESIMANCATIESPLETAMENTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
--DBMS_OUTPUT.put_line('...creati.');
|
||||
-- dbms_output.put_line('i campi sono.... operatore... ' || AOM_op || '....AOM_msisdn ....' || AOM_msisdn || '....AOM_data_attesa....' || AOM_data_attesa ||'.....AOM_cod_richiesta.....>'||AOM_cod_richiesta||'<');
|
||||
-- dbms_output.put_line('.....AOM_cod_richiesta.....>'|| AOM_cod_richiesta||'<');
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('2 e id richiesta tim è....' || tim_id_richiesta || '.......'|| 'stato....'||stato);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
count_mancanti := count_mancanti + 1;
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore:, ' || ';'||operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate espletamenti: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' ||';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' ||';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' ||';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate: ' ||';'|| count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' ||';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' ||';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' ||';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'Porting OK: ' ||';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,239 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
ind1 NUMBER(05):=0;
|
||||
ind2 NUMBER(05):=0;
|
||||
ind3 NUMBER(05):=0;
|
||||
ind4 NUMBER(05):=0;
|
||||
ind5 NUMBER(05):=0;
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
conta number(10):=0;
|
||||
|
||||
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
richiestaxml varchar2(40);
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATENOTIFICHETERZEPARTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'SINTESIMANCATENOTIFICHETERZEPARTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
--DBMS_OUTPUT.put_line('...creati.');
|
||||
-- dbms_output.put_line('i campi sono.... operatore... ' || AOM_op || '....AOM_msisdn ....' || AOM_msisdn || '....AOM_data_attesa....' || AOM_data_attesa ||'.....AOM_cod_richiesta.....>'||AOM_cod_richiesta||'<');
|
||||
-- dbms_output.put_line('.....AOM_cod_richiesta.....>'|| AOM_cod_richiesta||'<');
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, null, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
--decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
-- controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta_porting r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_recipient =operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('2 e id richiesta tim è....' || tim_id_richiesta || '.......'|| 'stato....'||stato);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
count_mancanti := count_mancanti + 1;
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore: ' || ';'||operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate espletamenti terze parti: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' ||';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' ||';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' || ';'||count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' ||';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate: ' || ';'||count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' ||';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' ||';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' ||';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'Porting OK: ' ||';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,240 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
ind1 NUMBER(05):=0;
|
||||
ind2 NUMBER(05):=0;
|
||||
ind3 NUMBER(05):=0;
|
||||
ind4 NUMBER(05):=0;
|
||||
ind5 NUMBER(05):=0;
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
conta number(10):=0;
|
||||
|
||||
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
richiestaxml varchar2(40);
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
|
||||
begin
|
||||
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATENOTIFICHETERZEPARTI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'SINTESIMANCATENOTIFICHETERZEPARTI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
ind5 := INSTR (line, ';',1,5);
|
||||
if (ind5 = 0) then
|
||||
ind5 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0 and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
--DBMS_OUTPUT.put_line('...creati.');
|
||||
-- dbms_output.put_line('i campi sono.... operatore... ' || AOM_op || '....AOM_msisdn ....' || AOM_msisdn || '....AOM_data_attesa....' || AOM_data_attesa ||'.....AOM_cod_richiesta.....>'||AOM_cod_richiesta||'<');
|
||||
-- dbms_output.put_line('.....AOM_cod_richiesta.....>'|| AOM_cod_richiesta||'<');
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, null, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
--decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
-- controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta_porting r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_recipient =operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 6;
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('2 e id richiesta tim è....' || tim_id_richiesta || '.......'|| 'stato....'||stato);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
count_mancanti := count_mancanti + 1;
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore: ' || ';'||operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate espletamenti terze parti: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' ||';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' ||';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' || ';'||count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' ||';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate: ' || ';'||count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' ||';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' ||';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' ||';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'Porting OK: ' ||';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
--read_error exception;
|
||||
--write_error exception;
|
||||
--invalid_path exception;
|
||||
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
flag number(1,0):=0;
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATEPRESEINCARICO_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'SINTESIMANCATEPRESEINCARICO_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
-- ind5 := INSTR (line, ';',1,5);
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
--AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
--substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 5;
|
||||
--and rownum < 2;
|
||||
--and r.stato = s.id_stato;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('count totale è...'|| count_totale ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn || '...tim_id_richiesta...'|| tim_id_richiesta);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
|
||||
count_mancanti := count_mancanti + 1;
|
||||
--DBMS_OUTPUT.put_line(' count_mancanti è...'|| count_mancanti ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
-- DBMS_OUTPUT.put_line(' count_preseincarico è...'|| count_preseincarico ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
-- DBMS_OUTPUT.put_line(' count_scartate è...'|| count_scartate ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
-- DBMS_OUTPUT.put_line(' count_accettate è...'|| count_accettate ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
-- DBMS_OUTPUT.put_line(' count_rifiutate è...'|| count_rifiutate ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
--DBMS_OUTPUT.put_line(' count_annullate è...'|| count_annullate ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
-- DBMS_OUTPUT.put_line(' count_portingOK è...'|| count_portingOK ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
--DBMS_OUTPUT.put_line(' count_presenti è...'|| count_presenti ||'...operatore donating....'|| AOM_op ||'...msisdn...'|| AOM_msisdn);
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore: ' ||';'|| operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate prese in carico: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' || ';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' || ';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' ||';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' || ';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' ||';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate:' ||';'|| count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' ||';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' || ';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' ||';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'PortingOK: ' || ';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
-- dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,240 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
--read_error exception;
|
||||
--write_error exception;
|
||||
--invalid_path exception;
|
||||
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
flag number(1,0):=0;
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATEPRESEINCARICO_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'SINTESIMANCATEPRESEINCARICO_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
--ind5 := INSTR (line, ';',1,5);
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
-- AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
--substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 5;
|
||||
--and r.stato = s.id_stato;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('2 e id richiesta tim è....' || tim_id_richiesta || '.......'|| 'stato....'||stato);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
count_mancanti := count_mancanti + 1;
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore: ' ||';'|| operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate prese in carico: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' || ';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' || ';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' || ';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' ||';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate:' || ';'|| count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' || ';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' || ';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' ||';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'PortingOK: ' || ';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' || ';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
-- dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,240 @@
|
||||
SET serveroutput on
|
||||
|
||||
select sysdate from dual;
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
--read_error exception;
|
||||
--write_error exception;
|
||||
--invalid_path exception;
|
||||
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
richiestaxml varchar2(40);
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
filename := upper(operatore)||'_to_TIMG_MANCATEVALIDAZIONI_'|| to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
|
||||
-- dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMG_to_'|| substr(filename,0,5) ||'SINTESIMANCATEVALIDAZIONI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
--ind5 := INSTR (line, ';',1,5);
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
-- AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
--DBMS_OUTPUT.put_line('...creati.');
|
||||
-- dbms_output.put_line('i campi sono.... operatore... ' || AOM_op || '....AOM_msisdn ....' || AOM_msisdn || '....AOM_data_attesa....' || AOM_data_attesa ||'.....AOM_cod_richiesta.....>'||AOM_cod_richiesta||'<');
|
||||
-- dbms_output.put_line('.....AOM_cod_richiesta.....>'|| AOM_cod_richiesta||'<');
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 2;
|
||||
--and rownum < 2;
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('2 e id richiesta tim è....' || tim_id_richiesta || '.......'|| 'stato....'||stato);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
count_mancanti := count_mancanti + 1;
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore: ' ||';'|| operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate validazioni: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' ||';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' ||';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' ||';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate: ' ||';'|| count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' ||';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' ||';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' ||';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'Porting OK: ' ||';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' || ';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,238 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
line VARCHAR2 (255);
|
||||
AOM_cod_richiesta VARCHAR2 (200);--mnp_gestione_richiesta.codice_richiesta_recipient%type;
|
||||
AOM_msisdn VARCHAR2 (200);--mnp_gestione_richiesta.msisdn%type;
|
||||
AOM_op VARCHAR2 (200);--mnp_gestione_richiesta.codice_operatore_recipient%type;
|
||||
AOM_data_attesa VARCHAR2 (200);
|
||||
AOM_stato VARCHAR2 (20);
|
||||
data_attesa VARCHAR2 (10);
|
||||
--stato VARCHAR2 (20);
|
||||
id_xml_tim VARCHAR2 (27);
|
||||
id_ack_aom VARCHAR2 (27);
|
||||
tecnologia VARCHAR2 (01);
|
||||
stato VARCHAR2 (40);
|
||||
tipologia_cl VARCHAR2 (02);
|
||||
tipologia_ut VARCHAR2 (03);
|
||||
tim_id_richiesta VARCHAR2 (23);
|
||||
controllo_presaincarico VARCHAR2 (50);
|
||||
ind1 NUMBER (05):=0;
|
||||
ind2 NUMBER (05):=0;
|
||||
ind3 NUMBER (05):=0;
|
||||
ind4 NUMBER (05):=0;
|
||||
ind5 NUMBER (05):=0;
|
||||
data_xml_tim date; --VARCHAR2 (20);
|
||||
data_ack_aom date;
|
||||
data_valid_max DATE;
|
||||
data_cut_over DATE;
|
||||
filename varchar2(100);
|
||||
operatore varchar2(100);
|
||||
desc_stato varchar2(40);
|
||||
conta number(10):=0;
|
||||
|
||||
FILE UTL_FILE.file_type;
|
||||
filein UTL_FILE.file_type;
|
||||
fileout UTL_FILE.file_type;
|
||||
--read_error exception;
|
||||
--write_error exception;
|
||||
--invalid_path exception;
|
||||
|
||||
count_mancanti NUMBER(05,0);
|
||||
count_preseincarico NUMBER(05,0);
|
||||
count_scartate NUMBER(05,0);
|
||||
count_accettate NUMBER(05,0);
|
||||
count_rifiutate NUMBER(05,0);
|
||||
count_annullate NUMBER(05,0);
|
||||
count_portingOK NUMBER(05,0);
|
||||
count_totale NUMBER(05,0);
|
||||
count_presenti NUMBER(05,0);
|
||||
dir_out varchar2(255);
|
||||
dir_in varchar2(255);
|
||||
richiestaxml varchar2(40);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo, donor_in, donor_out
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG');
|
||||
|
||||
begin
|
||||
|
||||
--dbms_output.put_line(' inizio ');
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore,dir_in, dir_out;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
|
||||
|
||||
filename := upper(operatore)||'_to_TIMT_MANCATEVALIDAZIONI_'||to_char(sysdate,'yyyyMMdd')||'.csv';
|
||||
--dbms_output.put_line('Inizio lettura file ' || filename);
|
||||
|
||||
count_scartate := 0;
|
||||
count_preseincarico := 0;
|
||||
count_accettate := 0;
|
||||
count_rifiutate := 0;
|
||||
count_annullate := 0;
|
||||
count_portingOK := 0;
|
||||
count_mancanti := 0;
|
||||
count_totale := 0;
|
||||
count_presenti := 0;
|
||||
|
||||
--filename := 'WIND_to_TIMG_mancatepreseincarico_20030211.csv';
|
||||
begin
|
||||
if (p <> 'nullo')then
|
||||
dir_out:='&1';
|
||||
dir_in :='&2';
|
||||
end if;
|
||||
filein := UTL_FILE.fopen (dir_in, filename , 'r');
|
||||
fileout := UTL_FILE.fopen (dir_out, 'TIMT_to_'|| substr(filename,0,5) ||'SINTESIMANCATEVALIDAZIONI_' || to_char(sysdate,'yyyyMMdd') ||'.csv', 'w');
|
||||
|
||||
UTL_FILE.get_line (filein, line); -- toglie intestazione
|
||||
-- conta:= 0;
|
||||
LOOP
|
||||
BEGIN
|
||||
|
||||
UTL_FILE.get_line (filein, line);
|
||||
EXCEPTION
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
--dbms_output.put_line('Errore : '|| sqlerrm ||' '|| sqlcode);
|
||||
goto termina;
|
||||
END;
|
||||
|
||||
ind1 := INSTR (line, ';',1,1);
|
||||
ind2 := INSTR (line, ';',1,2);
|
||||
ind3 := INSTR (line, ';',1,3);
|
||||
ind4 := INSTR (line, ';',1,4);
|
||||
-- ind5 := INSTR (line, ';',1,5);
|
||||
if (ind4 = 0) then
|
||||
ind4 := length(line) +1;
|
||||
end if;
|
||||
|
||||
--dbms_output.put_line('ind...'||ind1||'|'||ind2||'|'||ind3||'|'||ind4||'|'||ind5||'|');
|
||||
IF (ind1 > 0 and ind2 > 0 and ind3 > 0)-- and ind4 > 0)
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('gli indici sono....');
|
||||
AOM_cod_richiesta := trim(SUBSTR (line, 1 , ind1- 1));
|
||||
AOM_msisdn := trim(SUBSTR (line, ind1+1, (ind2-1)-ind1 ));
|
||||
AOM_op := trim(SUBSTR (line, ind2+1, (ind3-1)-ind2 ));
|
||||
AOM_data_attesa := trim(SUBSTR (line, ind3+1, (ind4-1)-ind3 ));
|
||||
--AOM_stato := trim(SUBSTR (line, ind4+1, (ind5-1)-ind4 ));
|
||||
|
||||
tim_id_richiesta := '';
|
||||
--DBMS_OUTPUT.put_line('1');
|
||||
|
||||
begin
|
||||
|
||||
|
||||
select r.id_richiesta, data_validazione_max, data_cut_over,
|
||||
decode(r.stato,6,3, 13,12, 7,9, 8,10, 14,9, 15,16, r.stato) stato,
|
||||
decode(r.cod_controllo_presaincarico,6,'Presa in carico', 3,'Sospensione manutenzione di sistemi', 7,'Waiting list', 8,'Overflow', 9,'Codice non univoco', '') cod_controllo_presaincarico,
|
||||
--decode(substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,1),0,'Accettata',1,'Rifiutata',2,'Annullato',3,'Sospesa per manutenzione programmata',4,'Porting OK',5,'Porting KO',6,'Presa in carico',7,'Scartata Waiting List',8,'In OverFlow',9,'Scartata per codice richiesta duplicato',10,'Sospesa per progetti ad Hoc') richiestaxml
|
||||
substr(xo.richiestaxml,instr(xo.richiestaxml,'<STATO_RICHIESTA_NOTIFICA>',1,1)+26,2) richiestaxml
|
||||
into tim_id_richiesta,data_valid_max, data_cut_over,
|
||||
stato,
|
||||
controllo_presaincarico,
|
||||
richiestaxml
|
||||
|
||||
from mnp_gestione_richiesta r, mnp_xml_out o, mnp_xml_richiesta_out xo
|
||||
where codice_richiesta_recipient = AOM_cod_richiesta
|
||||
and msisdn = AOM_msisdn
|
||||
and codice_operatore_donating = AOM_op
|
||||
and codice_operatore_recipient = operatore
|
||||
and r.id_richiesta = xo.id_richiesta
|
||||
and o.nome_file = xo.nome_file
|
||||
and o.tipo_file = 2;
|
||||
|
||||
|
||||
|
||||
|
||||
exception
|
||||
WHEN NO_DATA_FOUND
|
||||
THEN
|
||||
-- DBMS_OUTPUT.put_line('niente sql');
|
||||
null;
|
||||
END;
|
||||
count_totale := count_totale + 1;
|
||||
--DBMS_OUTPUT.put_line('2 e id richiesta tim è....' || tim_id_richiesta || '.......'|| 'stato....'||stato);
|
||||
IF (tim_id_richiesta is null) THEN
|
||||
count_mancanti := count_mancanti + 1;
|
||||
ELSE
|
||||
if (stato = 3)then
|
||||
count_preseincarico := count_preseincarico + 1;
|
||||
end if;
|
||||
if (stato = 4)then
|
||||
count_scartate := count_scartate + 1;
|
||||
end if;
|
||||
if (stato = 9)then
|
||||
count_accettate := count_accettate + 1;
|
||||
end if;
|
||||
if (stato = 10)then
|
||||
count_rifiutate := count_rifiutate + 1;
|
||||
end if;
|
||||
if (stato = 12)then
|
||||
count_annullate := count_annullate + 1;
|
||||
end if;
|
||||
if (stato = 16)then
|
||||
count_portingOK := count_portingOK + 1;
|
||||
end if;
|
||||
|
||||
count_presenti:= count_presenti + 1;
|
||||
|
||||
|
||||
END IF;
|
||||
ELSE
|
||||
UTL_FILE.put_line (fileout,'File sorgente non formattato correttamente.');
|
||||
END IF;
|
||||
conta :=conta +1;
|
||||
END LOOP;
|
||||
conta:= 0;
|
||||
<<termina>>
|
||||
if (conta = 0) then
|
||||
dbms_output.put_line('Non ci sono richieste da elaborare nel seguente file : '|| filename);
|
||||
end if;
|
||||
UTL_FILE.put_line (fileout,'Operatore: ' ||';'|| operatore);
|
||||
UTL_FILE.put_line (fileout,'Segnalazione mancate validazioni: ');
|
||||
UTL_FILE.put_line (fileout,'Data : ' ||';'|| trunc(sysdate));
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
UTL_FILE.put_line (fileout,'Presenti: ' || ';'|| count_presenti);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ');
|
||||
UTL_FILE.put_line (fileout,'Prese in carico: ' || ';'|| count_preseincarico);
|
||||
UTL_FILE.put_line (fileout,'Scartate: ' ||';'|| count_scartate);
|
||||
UTL_FILE.put_line (fileout,'Accettate: ' || ';'|| count_accettate);
|
||||
UTL_FILE.put_line (fileout,'Rifiutate: ' || ';'|| count_rifiutate);
|
||||
UTL_FILE.put_line (fileout,'Annullate: ' || ';'|| count_annullate);
|
||||
UTL_FILE.put_line (fileout,'Porting OK: ' ||';'|| count_portingOK);
|
||||
UTL_FILE.put_line (fileout,'Mancanti: ' ||';'|| count_mancanti);
|
||||
UTL_FILE.put_line (fileout,' ' );
|
||||
UTL_FILE.put_line (fileout,'Totale: ' ||';'|| count_totale);
|
||||
|
||||
UTL_FILE.fflush (fileout);
|
||||
UTL_FILE.fclose (fileout);
|
||||
UTL_FILE.fclose (filein);
|
||||
|
||||
exception
|
||||
|
||||
when UTL_FILE.invalid_operation then
|
||||
dbms_output.put_line('Non esiste il file : ' || filename );
|
||||
null;
|
||||
|
||||
when others then
|
||||
dbms_output.put_line('Si è verificato un errore di sistema.... ');
|
||||
null;
|
||||
end;
|
||||
--dbms_output.put_line('Fine lettura file ' || filename);
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur_operatori;
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
@@ -0,0 +1,388 @@
|
||||
set Serveroutput ON
|
||||
------------------------------------------------------------
|
||||
-- Report mensile riferito a tutte le richieste soggette a SLA
|
||||
-- nel caso in cui TIM Donor (standard) o Terza Parte
|
||||
-- (il mese e l'anno di elaborazione sono forniti in input)
|
||||
-- Ida Capone Braga 5 Agosto 2004
|
||||
------------------------------------------------------------
|
||||
|
||||
DECLARE
|
||||
mese number(2) := '';
|
||||
anno number(4) := '';
|
||||
File_Output UTL_FILE.file_type; -- dichiaro il file di output
|
||||
Directory_Output Varchar2(255) := ''; -- directory di output del file
|
||||
Mese_Anno_Riferimento Varchar2(10) := ''; -- costituisce una parte del nome del file di output
|
||||
Mese_Anno_Rif_Num Number(10) := 0; -- mi serve anche in formato numerico per i confronti
|
||||
|
||||
V_aom_recipient varchar2(4) :='';
|
||||
|
||||
errore number (1) := 0;
|
||||
|
||||
-- TOTALI RICHIESTE SLA (colonna di sinistra del report)
|
||||
Sla_0_Min Number (9) := 0;
|
||||
Sla_0_Max Number (9) := 0;
|
||||
Sla_1_Min Number (9) := 0;
|
||||
Sla_1_Max Number (9) := 0;
|
||||
Sla_2_Min Number (9) := 0;
|
||||
Sla_2_Max Number (9) := 0;
|
||||
Sla_3_Min Number (9) := 0;
|
||||
Sla_3_Max Number (9) := 0;
|
||||
|
||||
-- TOTALI GIORNI SLA (colonna di destra del report)
|
||||
Gg_Sla_0_Min Number (9) := 0;
|
||||
Gg_Sla_0_Max Number (9) := 0;
|
||||
Gg_Sla_1_Min Number (9) := 0;
|
||||
Gg_Sla_1_Max Number (9) := 0;
|
||||
Gg_Sla_2_Min Number (9) := 0;
|
||||
Gg_Sla_2_Max Number (9) := 0;
|
||||
Gg_Sla_3_Min Number (9) := 0;
|
||||
Gg_Sla_3_Max Number (9) := 0;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Totale generale delle linee (raggruppate per marcaggio) in ritardo
|
||||
-----------------------------------------------------------------
|
||||
tot_marcaggio Number (9) := 0;
|
||||
tot_marcaggio_donor Number (9) := 0;
|
||||
tot_marcaggio_tp Number (9) := 0;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Definizione cursore per l'estrazione degli AOM RECIPIENT da trattare
|
||||
-----------------------------------------------------------------
|
||||
CURSOR C_Aom is
|
||||
Select distinct desc_olo
|
||||
From MNP.MNP_OLO
|
||||
Where flag_terze_parti = 1;
|
||||
|
||||
--------------------------------------------------------------------
|
||||
-- campi dei totali delle linee in ritardo raggruppate per marcaggio
|
||||
--------------------------------------------------------------------
|
||||
Tot_X Number (12) := 0;
|
||||
Tot_T Number (12) := 0;
|
||||
Tot_M Number (12) := 0;
|
||||
Tot_C Number (12) := 0;
|
||||
Tot_Tp Number (12) := 0;
|
||||
|
||||
BEGIN
|
||||
|
||||
mese := to_number ('&1');
|
||||
anno := to_number ('&2');
|
||||
|
||||
if mese > 12 or
|
||||
mese <= 0 then
|
||||
dbms_output.put_line ('Formato del mese scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if length (anno) < 4 then
|
||||
dbms_output.put_line ('Formato dell''anno scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if errore = 1 then
|
||||
dbms_output.put_line ('ERRORE NEL FORMATO DEI PARAMETRI IN INPUT');
|
||||
else
|
||||
BEGIN
|
||||
|
||||
Directory_Output := 'REPORT_SLA';
|
||||
|
||||
-- il mese e l'anno di riferimento sono forniti in input
|
||||
-- mese_anno_riferimento := to_char(mese)||'/'||to_char(anno);
|
||||
mese_anno_riferimento := lpad(to_char(mese),2,'0')||'/'||to_char(anno);
|
||||
|
||||
-- poi in versione numerica per i confronti nelle select
|
||||
mese_anno_rif_num := To_number(mese||anno);
|
||||
|
||||
Open C_Aom; -- mi estrae tutti gli AOM da trattare presenti in mnp_dw_donor
|
||||
|
||||
--- Inizio giro degli AOM
|
||||
|
||||
Loop Fetch c_aom Into V_aom_recipient;
|
||||
Exit When C_Aom%NotFound;
|
||||
|
||||
-- costruisco il nome del file per AOM
|
||||
file_output := utl_file.fopen (directory_output, 'SLA_DONOR_TERZEPARTI_'||V_aom_recipient||'_'||lpad(to_char(mese),2,'0')||anno||'.csv', 'w');
|
||||
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output, 'RICHIESTE STANDARD: MESE/ANNO DI RIFERIMENTO: '||mese_anno_riferimento);
|
||||
UTL_FILE.put_line (file_output, 'AOM RECIPIENT: '||V_aom_recipient);
|
||||
|
||||
-- calcolo i totali delle linee in ritardo raggruppate per marcaggio
|
||||
begin
|
||||
|
||||
Select count (*)
|
||||
Into tot_x
|
||||
From DWH.MNP_DW_DONOR A,
|
||||
DWH.MNP_DW_DONOR_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'X'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_t
|
||||
From DWH.MNP_DW_DONOR A,
|
||||
DWH.MNP_DW_DONOR_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'T'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_m
|
||||
From DWH.MNP_DW_DONOR A,
|
||||
DWH.MNP_DW_DONOR_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'M'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_c
|
||||
From DWH.MNP_DW_DONOR A,
|
||||
DWH.MNP_DW_DONOR_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'C'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_tp
|
||||
From DWH.MNP_DW_PORTING A,
|
||||
DWH.MNP_DW_PORTING_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo marcaggio :'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- calcolo il totale delle linee in ritardo
|
||||
Begin
|
||||
Select count (*)
|
||||
into tot_marcaggio_donor
|
||||
from DWH.MNP_DW_DONOR_SLA a,
|
||||
DWH.MNP_DW_DONOR b
|
||||
where b.aom_recipient = V_aom_recipient
|
||||
and a.id_richiesta = b.id_richiesta
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
exception when others then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali Linee in ritardo (donor):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
Begin
|
||||
Select count (*)
|
||||
into tot_marcaggio_tp
|
||||
from DWH.MNP_DW_PORTING_SLA a,
|
||||
DWH.MNP_DW_PORTING b
|
||||
where b.aom_recipient = V_aom_recipient
|
||||
and a.id_richiesta = b.id_richiesta
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
exception when others then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali Linee in ritardo (TP):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
tot_marcaggio := tot_marcaggio_tp + tot_marcaggio_donor;
|
||||
|
||||
-- riempio la terza riga dell'intestazione
|
||||
UTL_FILE.put_line (file_output, 'Totale linee in ritardo: '||tot_marcaggio||';'||'Linee X: '||tot_x||';'||
|
||||
'Linee T: '||tot_t||';'||'Linee M: '||tot_m||';'||'Linee C: '||tot_c||';'||'Terze Parti: '||tot_tp||';');
|
||||
|
||||
-- riempimento dei campi dei totali richieste SLA (0-2) --> colonna di sinistra del Report
|
||||
Begin
|
||||
Select count(sla_zero_minore)
|
||||
Into sla_0_min
|
||||
From DWH.MNP_DW_DONOR_SLA A,
|
||||
DWH.MNP_DW_DONOR B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_zero_minore > 0;
|
||||
|
||||
Select count(sla_zero_maggiore)
|
||||
Into sla_0_max
|
||||
From DWH.MNP_DW_DONOR_SLA A,
|
||||
DWH.MNP_DW_DONOR B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_zero_maggiore > 0;
|
||||
|
||||
Select count(sla_uno_minore)
|
||||
Into sla_1_min
|
||||
From DWH.MNP_DW_DONOR_SLA A,
|
||||
DWH.MNP_DW_DONOR B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_uno_minore > 0;
|
||||
|
||||
Select count(sla_uno_maggiore)
|
||||
Into sla_1_max
|
||||
From DWH.MNP_DW_DONOR_SLA A,
|
||||
DWH.MNP_DW_DONOR B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_uno_maggiore > 0;
|
||||
|
||||
Select count(sla_due_minore)
|
||||
Into sla_2_min
|
||||
From DWH.MNP_DW_DONOR_SLA A,
|
||||
DWH.MNP_DW_DONOR B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_due_minore > 0;
|
||||
|
||||
Select count(sla_due_maggiore)
|
||||
Into sla_2_max
|
||||
From DWH.MNP_DW_DONOR_SLA A,
|
||||
DWH.MNP_DW_DONOR B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_due_maggiore > 0;
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali richieste SLA (0-2):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (0-2) --> colonna di destra del Report
|
||||
Begin
|
||||
|
||||
Select nvl(sum(sla_zero_minore),0), nvl(sum(sla_zero_maggiore),0),
|
||||
nvl(sum(sla_uno_minore),0), nvl(sum(sla_uno_maggiore),0),
|
||||
nvl(sum(sla_due_minore),0), nvl(sum(sla_due_maggiore),0)
|
||||
Into gg_sla_0_min, gg_sla_0_max,
|
||||
gg_sla_1_min, gg_sla_1_max,
|
||||
gg_sla_2_min, gg_sla_2_max
|
||||
From DWH.MNP_DW_DONOR_SLA A,
|
||||
DWH.MNP_DW_DONOR B
|
||||
Where mese||anno = mese_anno_rif_num
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And a.id_richiesta=b.id_richiesta ;
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali giorni SLA (0-2):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End ;
|
||||
|
||||
|
||||
-- riempimento dei campi dei totali richieste SLA (3) --> colonna di sinistra del Report
|
||||
Begin
|
||||
Select Count(Sla_Tre_Minore)
|
||||
Into Sla_3_Min
|
||||
From DWH.MNP_DW_PORTING_SLA A,
|
||||
DWH.MNP_DW_PORTING B
|
||||
Where A.Id_Richiesta = B.Id_Richiesta
|
||||
And B.Aom_Recipient = V_aom_recipient
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Minore > 0;
|
||||
|
||||
Select Count(Sla_Tre_Maggiore)
|
||||
Into Sla_3_Max
|
||||
From DWH.MNP_DW_PORTING_SLA A,
|
||||
DWH.MNP_DW_PORTING B
|
||||
Where A.Id_Richiesta = B.Id_Richiesta
|
||||
And B.Aom_Recipient = V_aom_recipient
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Maggiore > 0;
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali richieste SLA (3):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (3) --> colonna di destra del Report
|
||||
Begin
|
||||
Select nvl(sum(sla_tre_minore),0),
|
||||
nvl(sum(sla_tre_maggiore),0)
|
||||
Into gg_sla_3_min,
|
||||
gg_sla_3_max
|
||||
From DWH.MNP_DW_PORTING_SLA A,
|
||||
DWH.MNP_DW_PORTING B
|
||||
Where mese||anno = mese_anno_rif_num
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And a.id_richiesta=b.id_richiesta ;
|
||||
Exception When Others then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali giorni SLA (3):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
Exit;
|
||||
End ;
|
||||
|
||||
-- costruisco le linee di dettaglio del report con i valori appena estratti
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 <=4: '||sla_0_min||';'||'Totale SLA0 <=4: '||gg_sla_0_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 >4: '||sla_0_max||';'||'Totale SLA0 >4: '||gg_sla_0_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 <=4: '||sla_1_min||';'||'Totale SLA1 <=4: '||gg_sla_1_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 >4: '||sla_1_max||';'||'Totale SLA1 >4: '||gg_sla_1_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 <=4: '||sla_2_min||';'||'Totale SLA2 <=4: '||gg_sla_2_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 >4: '||sla_2_max||';'||'Totale SLA2 >4: '||gg_sla_2_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA3 <=4: '||sla_3_min||';'||'Totale SLA3 <=4: '||gg_sla_3_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA3 >4: '||sla_3_max||';'||'Totale SLA3 >4: '||gg_sla_3_max||';');
|
||||
|
||||
-- chiudo il file per operatore
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file e buonanotte all'aom
|
||||
|
||||
End Loop; -- fine del loop del cursore c_aom (V_aom_recipient)
|
||||
|
||||
--- FINE giro degli AOM
|
||||
|
||||
CLOSE c_aom;
|
||||
|
||||
EXCEPTION
|
||||
When UTL_FILE.INVALID_PATH Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
|
||||
When UTL_FILE.INVALID_MODE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_MODE');
|
||||
When UTL_FILE.INVALID_FILEHANDLE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_FILEHANDLE');
|
||||
When UTL_FILE.INVALID_OPERATION Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_OPERATION');
|
||||
When UTL_FILE.READ_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.READ_ERROR');
|
||||
When UTL_FILE.WRITE_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.WRITE_ERROR');
|
||||
When UTL_FILE.INTERNAL_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INTERNAL_ERROR');
|
||||
When OTHERS Then
|
||||
DBMS_OUTPUT.PUT_LINE(SQLERRM);
|
||||
END;
|
||||
|
||||
end if; -- fine del controllo per errore = 1 (errore nel formato dei parametri in input)
|
||||
|
||||
END;
|
||||
/
|
||||
exit
|
||||
303
dbcmnpsrc/FE/mnpapp/script/report/sql/report_sla_donor_hoc.sql
Normal file
303
dbcmnpsrc/FE/mnpapp/script/report/sql/report_sla_donor_hoc.sql
Normal file
@@ -0,0 +1,303 @@
|
||||
set Serveroutput ON
|
||||
------------------------------------------------------------
|
||||
-- Report mensile riferito a tutte le richieste soggette a SLA
|
||||
-- nel caso in cui TIM Donor (standard) o Terza Parte
|
||||
-- (il mese e l'anno di elaborazione sono forniti in input)
|
||||
-- Ida Capone Braga 5 Agosto 2004
|
||||
------------------------------------------------------------
|
||||
|
||||
DECLARE
|
||||
mese number(2) := '';
|
||||
anno number(4) := '';
|
||||
File_Output UTL_FILE.file_type; -- dichiaro il file di output
|
||||
Directory_Output Varchar2(255) := ''; -- directory di output del file
|
||||
Mese_Anno_Riferimento Varchar2(10) := ''; -- costituisce una parte del nome del file di output
|
||||
Mese_Anno_Rif_Num Number(10) := 0; -- mi serve anche in formato numerico per i confronti
|
||||
|
||||
V_aom_recipient varchar2(4) :='';
|
||||
|
||||
errore number (1) := 0;
|
||||
|
||||
-- TOTALI RICHIESTE SLA (colonna di sinistra del report)
|
||||
Sla_0_Min Number (9) := 0;
|
||||
Sla_0_Max Number (9) := 0;
|
||||
Sla_1_Min Number (9) := 0;
|
||||
Sla_1_Max Number (9) := 0;
|
||||
Sla_2_Min Number (9) := 0;
|
||||
Sla_2_Max Number (9) := 0;
|
||||
|
||||
-- TOTALI GIORNI SLA (colonna di destra del report)
|
||||
Gg_Sla_0_Min Number (9) := 0;
|
||||
Gg_Sla_0_Max Number (9) := 0;
|
||||
Gg_Sla_1_Min Number (9) := 0;
|
||||
Gg_Sla_1_Max Number (9) := 0;
|
||||
Gg_Sla_2_Min Number (9) := 0;
|
||||
Gg_Sla_2_Max Number (9) := 0;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Totale generale delle linee in ritardo
|
||||
-----------------------------------------------------------------
|
||||
tot_linee_ritardo Number (9) := 0;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Definizione cursore per l'estrazione degli AOM RECIPIENT da trattare
|
||||
-----------------------------------------------------------------
|
||||
CURSOR C_Aom is
|
||||
Select distinct desc_olo
|
||||
From MNP.MNP_OLO
|
||||
Where flag_terze_parti = 1;
|
||||
|
||||
--------------------------------------------------------------------
|
||||
-- campi dei totali delle linee in ritardo raggruppate per marcaggio
|
||||
--------------------------------------------------------------------
|
||||
Tot_X Number (12) := 0;
|
||||
Tot_T Number (12) := 0;
|
||||
Tot_M Number (12) := 0;
|
||||
Tot_C Number (12) := 0;
|
||||
Tot_Tp Number (12) := 0;
|
||||
|
||||
BEGIN
|
||||
|
||||
mese := to_number ('&1');
|
||||
anno := to_number ('&2');
|
||||
|
||||
if mese > 12 or
|
||||
mese <= 0 then
|
||||
dbms_output.put_line ('Formato del mese scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if length (anno) < 4 then
|
||||
dbms_output.put_line ('Formato dell''anno scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if errore = 1 then
|
||||
dbms_output.put_line ('ERRORE NEL FORMATO DEI PARAMETRI IN INPUT');
|
||||
else
|
||||
BEGIN
|
||||
|
||||
Directory_Output := 'REPORT_SLA';
|
||||
|
||||
-- il mese e l'anno di riferimento sono forniti in input
|
||||
mese_anno_riferimento := lpad(to_char(mese),2,0)||'/'||to_char(anno);
|
||||
|
||||
-- poi in versione numerica per i confronti nelle select
|
||||
mese_anno_rif_num := To_number(mese||anno);
|
||||
|
||||
Open C_Aom; -- mi estrae tutti gli AOM da trattare presenti in mnp_dw_donor
|
||||
|
||||
--- Inizio giro degli AOM
|
||||
|
||||
Loop Fetch c_aom Into V_aom_recipient;
|
||||
Exit When C_Aom%NotFound;
|
||||
|
||||
-- costruisco il nome del file per AOM
|
||||
file_output := utl_file.fopen (directory_output, 'SLA_DONOR_HOC_'||V_aom_recipient||'_'||lpad(to_char(mese),2,0)||anno||'.csv', 'w');
|
||||
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output, 'RICHIESTE AD HOC: MESE/ANNO DI RIFERIMENTO: '||mese_anno_riferimento);
|
||||
UTL_FILE.put_line (file_output, 'AOM RECIPIENT: '||V_aom_recipient);
|
||||
|
||||
-- calcolo i totali delle linee in ritardo raggruppate per marcaggio
|
||||
begin
|
||||
|
||||
Select count (*)
|
||||
Into tot_x
|
||||
From DWH.MNP_DW_DONOR_HOC A,
|
||||
DWH.MNP_DW_DONOR_HOC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'X'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_t
|
||||
From DWH.MNP_DW_DONOR_HOC A,
|
||||
DWH.MNP_DW_DONOR_HOC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'T'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_m
|
||||
From DWH.MNP_DW_DONOR_HOC A,
|
||||
DWH.MNP_DW_DONOR_HOC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'M'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_c
|
||||
From DWH.MNP_DW_DONOR_HOC A,
|
||||
DWH.MNP_DW_DONOR_HOC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.marcaggio = 'C'
|
||||
And a.aom_recipient = V_aom_recipient
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo marcaggio :'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- calcolo il totale delle linee in ritardo
|
||||
Begin
|
||||
Select count (*)
|
||||
into tot_linee_ritardo
|
||||
from DWH.MNP_DW_DONOR_HOC_SLA a,
|
||||
DWH.MNP_DW_DONOR_HOC b
|
||||
where b.aom_recipient = V_aom_recipient
|
||||
and a.id_richiesta = b.id_richiesta
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
exception when others then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali Linee in ritardo :'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- riempio la terza riga dell'intestazione
|
||||
UTL_FILE.put_line (file_output, 'Totale linee in ritardo: '||tot_linee_ritardo||';'||'Linee X: '||tot_x||';'||
|
||||
'Linee T: '||tot_t||';'||'Linee M: '||tot_m||';'||'Linee C: '||tot_c||';');
|
||||
|
||||
-- riempimento dei campi dei totali richieste SLA (0-2) --> colonna di sinistra del Report
|
||||
Begin
|
||||
Select count(sla_zero_minore)
|
||||
Into sla_0_min
|
||||
From DWH.MNP_DW_DONOR_HOC_SLA A,
|
||||
DWH.MNP_DW_DONOR_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_zero_minore > 0;
|
||||
|
||||
Select count(sla_zero_maggiore)
|
||||
Into sla_0_max
|
||||
From DWH.MNP_DW_DONOR_HOC_SLA A,
|
||||
DWH.MNP_DW_DONOR_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_zero_maggiore > 0;
|
||||
|
||||
Select count(sla_uno_minore)
|
||||
Into sla_1_min
|
||||
From DWH.MNP_DW_DONOR_HOC_SLA A,
|
||||
DWH.MNP_DW_DONOR_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_uno_minore > 0;
|
||||
|
||||
Select count(sla_uno_maggiore)
|
||||
Into sla_1_max
|
||||
From DWH.MNP_DW_DONOR_HOC_SLA A,
|
||||
DWH.MNP_DW_DONOR_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_uno_maggiore > 0;
|
||||
|
||||
Select count(sla_due_minore)
|
||||
Into sla_2_min
|
||||
From DWH.MNP_DW_DONOR_HOC_SLA A,
|
||||
DWH.MNP_DW_DONOR_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_due_minore > 0;
|
||||
|
||||
Select count(sla_due_maggiore)
|
||||
Into sla_2_max
|
||||
From DWH.MNP_DW_DONOR_HOC_SLA A,
|
||||
DWH.MNP_DW_DONOR_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And mese||anno = mese_anno_rif_num
|
||||
And sla_due_maggiore > 0;
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali richieste SLA (0-2):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (0-2) --> colonna di destra del Report
|
||||
Begin
|
||||
|
||||
Select nvl(sum(sla_zero_minore),0), nvl(sum(sla_zero_maggiore),0),
|
||||
nvl(sum(sla_uno_minore),0), nvl(sum(sla_uno_maggiore),0),
|
||||
nvl(sum(sla_due_minore),0), nvl(sum(sla_due_maggiore),0)
|
||||
Into gg_sla_0_min, gg_sla_0_max,
|
||||
gg_sla_1_min, gg_sla_1_max,
|
||||
gg_sla_2_min, gg_sla_2_max
|
||||
From DWH.MNP_DW_DONOR_HOC_SLA A,
|
||||
DWH.MNP_DW_DONOR_HOC B
|
||||
Where mese||anno = mese_anno_rif_num
|
||||
And b.aom_recipient = V_aom_recipient
|
||||
And a.id_richiesta=b.id_richiesta ;
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali giorni SLA (0-2):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End ;
|
||||
|
||||
-- costruisco le linee di dettaglio del report con i valori appena estratti
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 <=4: '||sla_0_min||';'||'Totale SLA0 <=4: '||gg_sla_0_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 >4: '||sla_0_max||';'||'Totale SLA0 >4: '||gg_sla_0_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 <=4: '||sla_1_min||';'||'Totale SLA1 <=4: '||gg_sla_1_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 >4: '||sla_1_max||';'||'Totale SLA1 >4: '||gg_sla_1_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 <=4: '||sla_2_min||';'||'Totale SLA2 <=4: '||gg_sla_2_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 >4: '||sla_2_max||';'||'Totale SLA2 >4: '||gg_sla_2_max||';');
|
||||
|
||||
-- chiudo il file per operatore
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file e buonanotte all'aom
|
||||
|
||||
End Loop; -- fine del loop del cursore c_aom (V_aom_recipient)
|
||||
|
||||
--- FINE giro degli AOM
|
||||
|
||||
CLOSE c_aom;
|
||||
|
||||
EXCEPTION
|
||||
When UTL_FILE.INVALID_PATH Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
|
||||
When UTL_FILE.INVALID_MODE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_MODE');
|
||||
When UTL_FILE.INVALID_FILEHANDLE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_FILEHANDLE');
|
||||
When UTL_FILE.INVALID_OPERATION Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_OPERATION');
|
||||
When UTL_FILE.READ_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.READ_ERROR');
|
||||
When UTL_FILE.WRITE_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.WRITE_ERROR');
|
||||
When UTL_FILE.INTERNAL_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INTERNAL_ERROR');
|
||||
When OTHERS Then
|
||||
DBMS_OUTPUT.PUT_LINE(SQLERRM);
|
||||
END;
|
||||
|
||||
end if; -- fine del controllo per errore = 1 (errore nel formato dei parametri in input)
|
||||
|
||||
END;
|
||||
/
|
||||
exit
|
||||
436
dbcmnpsrc/FE/mnpapp/script/report/sql/report_sla_recipient.sql
Normal file
436
dbcmnpsrc/FE/mnpapp/script/report/sql/report_sla_recipient.sql
Normal file
@@ -0,0 +1,436 @@
|
||||
set Serveroutput ON
|
||||
------------------------------------------------------------
|
||||
-- Report mensile riferito a tutte le richieste soggette a SLA
|
||||
-- nel caso in cui TIM e' recipient (standard e scivolo tacs)
|
||||
-- (il mese e l'anno di elaborazione sono forniti in input)
|
||||
-- Ida Capone Braga 18 Agosto 2004
|
||||
------------------------------------------------------------
|
||||
|
||||
DECLARE
|
||||
mese number(2) := '';
|
||||
anno number(4) := '';
|
||||
File_Output UTL_FILE.file_type; -- dichiaro il file di output
|
||||
Directory_Output Varchar2(255) := ''; -- directory di output del file
|
||||
Mese_Anno_Riferimento Varchar2(10) := ''; -- costituisce una parte del nome del file di output
|
||||
Mese_Anno_Rif_Num Number(10) := 0; -- mi serve anche in formato numerico per i confronti
|
||||
|
||||
V_aom_donor varchar2(4) :='';
|
||||
|
||||
errore number (1) := 0;
|
||||
|
||||
-- TOTALI RICHIESTE SLA (colonna di sinistra del report)
|
||||
Sla_0_Min Number (9) := 0;
|
||||
Sla_0_Max Number (9) := 0;
|
||||
Sla_1_Min Number (9) := 0;
|
||||
Sla_1_Max Number (9) := 0;
|
||||
Sla_2_Min Number (9) := 0;
|
||||
Sla_2_Max Number (9) := 0;
|
||||
Sla_3_Min Number (9) := 0;
|
||||
Sla_3_Max Number (9) := 0;
|
||||
|
||||
-- TOTALI GIORNI SLA (colonna di destra del report)
|
||||
Gg_Sla_0_Min Number (9) := 0;
|
||||
Gg_Sla_0_Max Number (9) := 0;
|
||||
Gg_Sla_1_Min Number (9) := 0;
|
||||
Gg_Sla_1_Max Number (9) := 0;
|
||||
Gg_Sla_2_Min Number (9) := 0;
|
||||
Gg_Sla_2_Max Number (9) := 0;
|
||||
Gg_Sla_3_Min Number (9) := 0;
|
||||
Gg_Sla_3_Max Number (9) := 0;
|
||||
|
||||
-- TOTALI PARZIALI PER GLI SLA3 CHE COMPRENDONO ANCHE GLI SCIVOLI TACS
|
||||
Sla_3_TP_Min Number (9) := 0;
|
||||
Sla_3_tacs_Min Number (9) := 0;
|
||||
Sla_3_TP_Max Number (9) := 0;
|
||||
Sla_3_tacs_Max Number (9) := 0;
|
||||
|
||||
-- TOTALI PARZIALI PER GLI SLA3 CHE COMPRENDONO ANCHE GLI SCIVOLI TACS
|
||||
gg_sla_3_TP_min Number (9) := 0;
|
||||
gg_sla_3_TP_max Number (9) := 0;
|
||||
gg_sla_3_tacs_min Number (9) := 0;
|
||||
gg_sla_3_tacs_max Number (9) := 0;
|
||||
-----------------------------------------------------------------
|
||||
-- Definizione totali linee in ritardo
|
||||
-----------------------------------------------------------------
|
||||
tot_ritardi Number (9) := 0;
|
||||
tot_recipient Number (9) := 0;
|
||||
tot_tp Number (9) := 0;
|
||||
tot_tacs Number (9) := 0;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Definizione cursore per l'estrazione degli AOM RECIPIENT da trattare
|
||||
-----------------------------------------------------------------
|
||||
CURSOR C_Aom is
|
||||
Select distinct desc_olo
|
||||
From MNP.MNP_OLO
|
||||
Where flag_terze_parti = 1;
|
||||
|
||||
--------------------------------------------------------------------
|
||||
-- campi dei totali delle linee in ritardo raggruppate per tipo_cliente (CO/BU)
|
||||
--------------------------------------------------------------------
|
||||
tot_BU_DONOR Number (12) := 0;
|
||||
tot_BU_TP_TACS Number (12) := 0;
|
||||
tot_BU_TP Number (12) := 0;
|
||||
tot_BU Number (12) := 0;
|
||||
|
||||
tot_CO_DONOR Number (12) := 0;
|
||||
tot_CO_TP_TACS Number (12) := 0;
|
||||
tot_CO_TP Number (12) := 0;
|
||||
tot_CO Number (12) := 0;
|
||||
|
||||
BEGIN
|
||||
|
||||
mese := to_number ('&1');
|
||||
anno := to_number ('&2');
|
||||
|
||||
if mese > 12 or
|
||||
mese <= 0 then
|
||||
dbms_output.put_line ('Formato del mese scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if length (anno) < 4 then
|
||||
dbms_output.put_line ('Formato dell''anno scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if errore = 1 then
|
||||
dbms_output.put_line ('ERRORE NEL FORMATO DEI PARAMETRI IN INPUT');
|
||||
else
|
||||
BEGIN
|
||||
|
||||
Directory_Output := 'REPORT_SLA';
|
||||
|
||||
-- il mese e l'anno di riferimento sono forniti in input
|
||||
mese_anno_riferimento := lpad(to_char(mese),2,0)||'/'||to_char(anno);
|
||||
|
||||
-- poi in versione numerica per i confronti nelle select
|
||||
mese_anno_rif_num := To_number(mese||anno);
|
||||
|
||||
Open C_Aom; -- mi estrae tutti gli AOM da trattare presenti in mnp_dw_donor
|
||||
|
||||
--- Inizio giro degli AOM
|
||||
|
||||
Loop Fetch c_aom Into V_aom_donor;
|
||||
Exit When C_Aom%NotFound;
|
||||
|
||||
-- costruisco il nome del file per AOM
|
||||
file_output := utl_file.fopen (directory_output, 'SLA_RECIPIENT_'||V_aom_donor||'_'||lpad(to_char(mese),2,0)||anno||'.csv', 'w');
|
||||
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output, 'RICHIESTE STANDARD: MESE/ANNO DI RIFERIMENTO: '||mese_anno_riferimento);
|
||||
UTL_FILE.put_line (file_output, 'AOM DONOR / TERZA PARTE: '||V_aom_donor);
|
||||
|
||||
-- calcolo i totali delle linee in ritardo raggruppate per tipo_cliente (CO/BU)
|
||||
begin
|
||||
-- totali BU
|
||||
Select count (*)
|
||||
Into tot_BU_DONOR
|
||||
From DWH.MNP_DW_REC A,
|
||||
DWH.MNP_DW_REC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.tipo_linea = 'BU'
|
||||
And a.aom_donor = V_aom_donor
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_BU_TP_TACS
|
||||
From DWH.MNP_DW_REC_TACS_SLA_TERZEPARTI d,
|
||||
DWH.MNP_DW_REC_TACS e
|
||||
where e.ID_RICHIESTA = d.ID_RICHIESTA
|
||||
And d.aom_terze_parti = V_aom_donor
|
||||
And d.mese||d.anno = mese_anno_rif_num
|
||||
and e.tipo_linea = 'BU';
|
||||
|
||||
Select count (*)
|
||||
Into tot_BU_TP
|
||||
From DWH.MNP_DW_REC_SLA_TERZEPARTI D,
|
||||
DWH.MNP_DW_REC E
|
||||
where e.Id_Richiesta = d.Id_Richiesta
|
||||
And d.aom_terze_parti = V_aom_donor
|
||||
And d.mese||d.anno = mese_anno_rif_num
|
||||
and e.tipo_linea = 'BU';
|
||||
|
||||
-- totali CO
|
||||
Select count (*)
|
||||
Into tot_CO_DONOR
|
||||
From DWH.MNP_DW_REC A,
|
||||
DWH.MNP_DW_REC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.tipo_linea = 'CO'
|
||||
And a.aom_donor = V_aom_donor
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_CO_TP_TACS
|
||||
From DWH.MNP_DW_REC_TACS_SLA_TERZEPARTI D,
|
||||
DWH.MNP_DW_REC_TACS e
|
||||
where e.ID_RICHIESTA = D.ID_RICHIESTA
|
||||
And d.aom_terze_parti = V_aom_donor
|
||||
And D.mese||D.anno = mese_anno_rif_num
|
||||
and e.tipo_linea = 'CO';
|
||||
|
||||
Select count (*)
|
||||
Into tot_CO_TP
|
||||
From DWH.MNP_DW_REC_SLA_TERZEPARTI D,
|
||||
DWH.MNP_DW_REC E
|
||||
where e.Id_Richiesta = d.Id_Richiesta
|
||||
And d.aom_terze_parti = V_aom_donor
|
||||
And D.mese||D.anno = mese_anno_rif_num
|
||||
And e.tipo_linea = 'CO';
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo Linee BU/CO :'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
tot_BU := tot_BU_DONOR + tot_BU_TP_TACS + tot_BU_TP;
|
||||
tot_CO := tot_CO_DONOR + tot_CO_TP_TACS + tot_CO_TP;
|
||||
|
||||
-- calcolo il totale delle linee in ritardo
|
||||
Begin
|
||||
Select count (*)
|
||||
Into tot_recipient
|
||||
From DWH.MNP_DW_REC a,
|
||||
DWH.MNP_DW_REC_SLA b
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.aom_donor = V_aom_donor
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_tp
|
||||
From DWH.MNP_DW_REC_SLA_TERZEPARTI a,
|
||||
DWH.MNP_DW_REC b
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.aom_terze_parti = V_aom_donor
|
||||
And a.mese||a.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_tacs
|
||||
From DWH.MNP_DW_REC_TACS_SLA_TERZEPARTI
|
||||
Where aom_terze_parti = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totale Linee in ritardo:'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
tot_ritardi := tot_recipient + tot_tp + tot_tacs;
|
||||
|
||||
-- riempio la terza riga dell'intestazione
|
||||
UTL_FILE.put_line (file_output, 'Totale linee in ritardo: '||tot_ritardi||';'||'Linee BU: '||tot_BU||';'||
|
||||
'Linee CO: '||tot_CO||';');
|
||||
|
||||
Begin
|
||||
-- riempimento dei campi dei totali richieste SLA (0-2) --> colonna di sinistra del Report
|
||||
-- DEVONO ESSERE CONTATI SINGOLARMENTE SOLO SE > 0
|
||||
Select count(sla_zero_minore)
|
||||
Into sla_0_min
|
||||
From DWH.MNP_DW_REC_SLA A,
|
||||
DWH.MNP_DW_REC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_zero_minore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_zero_maggiore)
|
||||
into sla_0_max
|
||||
From DWH.MNP_DW_REC_SLA A,
|
||||
DWH.MNP_DW_REC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_zero_maggiore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_uno_minore)
|
||||
Into sla_1_min
|
||||
From DWH.MNP_DW_REC_SLA A,
|
||||
DWH.MNP_DW_REC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_uno_minore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_uno_maggiore)
|
||||
Into sla_1_max
|
||||
From DWH.MNP_DW_REC_SLA A,
|
||||
DWH.MNP_DW_REC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_uno_maggiore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_due_minore)
|
||||
Into sla_2_min
|
||||
From DWH.MNP_DW_REC_SLA A,
|
||||
DWH.MNP_DW_REC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_due_minore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_due_maggiore)
|
||||
Into sla_2_max
|
||||
From DWH.MNP_DW_REC_SLA A,
|
||||
DWH.MNP_DW_REC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_due_maggiore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (0-2) --> colonna di destra del Report
|
||||
select nvl(sum(sla_zero_minore),0), nvl(sum(sla_zero_maggiore),0),
|
||||
nvl(sum(sla_uno_minore),0), nvl(sum(sla_uno_maggiore),0),
|
||||
nvl(sum(sla_due_minore),0), nvl(sum(sla_due_maggiore),0)
|
||||
into gg_sla_0_min, gg_sla_0_max,
|
||||
gg_sla_1_min, gg_sla_1_max,
|
||||
gg_sla_2_min, gg_sla_2_max
|
||||
From DWH.MNP_DW_REC_SLA A,
|
||||
DWH.MNP_DW_REC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali richieste SLA (0-2):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
Begin
|
||||
-- riempimento dei campi dei totali richieste SLA (3) --> colonna di sinistra del Report
|
||||
|
||||
-- Anche questi vanno calcolati singolarmente solo se > 0
|
||||
-- poi gli vanno sommati i compagnetti degli scivoli
|
||||
|
||||
Select Count(Sla_Tre_Minore)
|
||||
Into Sla_3_TP_Min
|
||||
From DWH.MNP_DW_REC_SLA_TERZEPARTI A,
|
||||
DWH.MNP_DW_REC_TERZEPARTI B
|
||||
Where A.Id_Richiesta = B.Id_Richiesta
|
||||
And B.aom_terze_parti = a.aom_terze_parti
|
||||
And b.aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Minore > 0;
|
||||
|
||||
Select Count(Sla_Tre_Maggiore)
|
||||
Into Sla_3_TP_Max
|
||||
From DWH.MNP_DW_REC_SLA_TERZEPARTI A,
|
||||
DWH.MNP_DW_REC_TERZEPARTI B
|
||||
Where A.Id_Richiesta = B.Id_Richiesta
|
||||
And B.aom_terze_parti = a.aom_terze_parti
|
||||
And b.aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Maggiore > 0;
|
||||
|
||||
-- ecco gli amichetti scivolati
|
||||
Select Count(Sla_Tre_Minore)
|
||||
Into Sla_3_tacs_Min
|
||||
From DWH.MNP_DW_REC_TACS_SLA_TERZEPARTI
|
||||
Where aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Minore > 0;
|
||||
|
||||
Select Count(Sla_Tre_Maggiore)
|
||||
Into Sla_3_tacs_Max
|
||||
From DWH.MNP_DW_REC_TACS_SLA_TERZEPARTI
|
||||
Where aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Maggiore > 0;
|
||||
|
||||
-- ora rimetto le uova nel paniere
|
||||
sla_3_min := Sla_3_TP_Min + Sla_3_tacs_Min;
|
||||
sla_3_max := Sla_3_TP_Max + Sla_3_tacs_Max;
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (3) --> colonna di destra del Report
|
||||
Select nvl(sum(sla_tre_minore),0),
|
||||
nvl(sum(sla_tre_maggiore),0)
|
||||
Into gg_sla_3_TP_min,
|
||||
gg_sla_3_TP_max
|
||||
From DWH.MNP_DW_REC_SLA_TERZEPARTI
|
||||
Where aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num;
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (3) per i TACS --> colonna di destra del Report
|
||||
Select nvl(sum(sla_tre_minore),0),
|
||||
nvl(sum(sla_tre_maggiore),0)
|
||||
Into gg_sla_3_tacs_min,
|
||||
gg_sla_3_tacs_max
|
||||
From DWH.MNP_DW_REC_TACS_SLA_TERZEPARTI
|
||||
Where aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num;
|
||||
|
||||
gg_sla_3_min := gg_sla_3_TP_min + gg_sla_3_tacs_min;
|
||||
gg_sla_3_max := gg_sla_3_TP_max + gg_sla_3_tacs_max;
|
||||
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali richieste SLA (3):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- costruisco le linee di dettaglio del report con i valori appena estratti
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 <=4: '||sla_0_min||';'||'Totale SLA0 <=4: '||gg_sla_0_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 >4: '||sla_0_max||';'||'Totale SLA0 >4: '||gg_sla_0_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 <=4: '||sla_1_min||';'||'Totale SLA1 <=4: '||gg_sla_1_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 >4: '||sla_1_max||';'||'Totale SLA1 >4: '||gg_sla_1_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 <=4: '||sla_2_min||';'||'Totale SLA2 <=4: '||gg_sla_2_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 >4: '||sla_2_max||';'||'Totale SLA2 >4: '||gg_sla_2_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA3 <=4: '||sla_3_min||';'||'Totale SLA3 <=4: '||gg_sla_3_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA3 >4: '||sla_3_max||';'||'Totale SLA3 >4: '||gg_sla_3_max||';');
|
||||
|
||||
-- chiudo il file per operatore
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file e buonanotte all'aom
|
||||
|
||||
End Loop; -- fine del loop del cursore c_aom (V_aom_donor)
|
||||
|
||||
--- FINE giro degli AOM
|
||||
|
||||
CLOSE c_aom;
|
||||
|
||||
EXCEPTION
|
||||
When UTL_FILE.INVALID_PATH Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
|
||||
When UTL_FILE.INVALID_MODE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_MODE');
|
||||
When UTL_FILE.INVALID_FILEHANDLE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_FILEHANDLE');
|
||||
When UTL_FILE.INVALID_OPERATION Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_OPERATION');
|
||||
When UTL_FILE.READ_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.READ_ERROR');
|
||||
When UTL_FILE.WRITE_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.WRITE_ERROR');
|
||||
When UTL_FILE.INTERNAL_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INTERNAL_ERROR');
|
||||
When OTHERS Then
|
||||
DBMS_OUTPUT.PUT_LINE(SQLERRM);
|
||||
END;
|
||||
|
||||
end if; -- fine del controllo per errore = 1 (errore nel formato dei parametri in input)
|
||||
|
||||
END;
|
||||
/
|
||||
exit
|
||||
@@ -0,0 +1,376 @@
|
||||
set Serveroutput ON
|
||||
------------------------------------------------------------
|
||||
-- Report mensile riferito a tutte le richieste soggette a SLA
|
||||
-- nel caso in cui TIM e' recipient (progetti ad hoc)
|
||||
-- (il mese e l'anno di elaborazione sono forniti in input)
|
||||
-- Ida Capone Braga 19 Agosto 2004
|
||||
------------------------------------------------------------
|
||||
|
||||
DECLARE
|
||||
mese number(2) := '';
|
||||
anno number(4) := '';
|
||||
File_Output UTL_FILE.file_type; -- dichiaro il file di output
|
||||
Directory_Output Varchar2(255) := ''; -- directory di output del file
|
||||
Mese_Anno_Riferimento Varchar2(10) := ''; -- costituisce una parte del nome del file di output
|
||||
Mese_Anno_Rif_Num Number(10) := 0; -- mi serve anche in formato numerico per i confronti
|
||||
|
||||
V_aom_donor varchar2(4) :='';
|
||||
|
||||
errore number (1) := 0;
|
||||
|
||||
-- TOTALI RICHIESTE SLA (colonna di sinistra del report)
|
||||
Sla_0_Min Number (9) := 0;
|
||||
Sla_0_Max Number (9) := 0;
|
||||
Sla_1_Min Number (9) := 0;
|
||||
Sla_1_Max Number (9) := 0;
|
||||
Sla_2_Min Number (9) := 0;
|
||||
Sla_2_Max Number (9) := 0;
|
||||
Sla_3_Min Number (9) := 0;
|
||||
Sla_3_Max Number (9) := 0;
|
||||
|
||||
-- TOTALI GIORNI SLA (colonna di destra del report)
|
||||
Gg_Sla_0_Min Number (9) := 0;
|
||||
Gg_Sla_0_Max Number (9) := 0;
|
||||
Gg_Sla_1_Min Number (9) := 0;
|
||||
Gg_Sla_1_Max Number (9) := 0;
|
||||
Gg_Sla_2_Min Number (9) := 0;
|
||||
Gg_Sla_2_Max Number (9) := 0;
|
||||
Gg_Sla_3_Min Number (9) := 0;
|
||||
Gg_Sla_3_Max Number (9) := 0;
|
||||
|
||||
-- TOTALI PARZIALI PER GLI SLA3 CHE COMPRENDONO ANCHE GLI SCIVOLI TACS
|
||||
Sla_3_TP_Min Number (9) := 0;
|
||||
Sla_3_tacs_Min Number (9) := 0;
|
||||
Sla_3_TP_Max Number (9) := 0;
|
||||
Sla_3_tacs_Max Number (9) := 0;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Definizione dei totali delle linee in ritardo
|
||||
-----------------------------------------------------------------
|
||||
|
||||
tot_ritardo Number (9) := 0;
|
||||
tot_rec Number (9) := 0;
|
||||
tot_tp Number (9) := 0;
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Definizione cursore per l'estrazione degli AOM RECIPIENT da trattare
|
||||
-----------------------------------------------------------------
|
||||
CURSOR C_Aom is
|
||||
Select distinct desc_olo
|
||||
From MNP.MNP_OLO
|
||||
Where flag_terze_parti = 1;
|
||||
|
||||
--------------------------------------------------------------------
|
||||
-- campi dei totali delle linee in ritardo raggruppate per tipo_cliente (CO/BU)
|
||||
--------------------------------------------------------------------
|
||||
tot_BU_DONOR Number (12) := 0;
|
||||
tot_BU_TP_TACS Number (12) := 0;
|
||||
tot_BU_TP Number (12) := 0;
|
||||
tot_BU Number (12) := 0;
|
||||
|
||||
tot_CO_DONOR Number (12) := 0;
|
||||
tot_CO_TP_TACS Number (12) := 0;
|
||||
tot_CO_TP Number (12) := 0;
|
||||
tot_CO Number (12) := 0;
|
||||
|
||||
BEGIN
|
||||
|
||||
mese := to_number ('&1');
|
||||
anno := to_number ('&2');
|
||||
|
||||
if mese > 12 or
|
||||
mese <= 0 then
|
||||
dbms_output.put_line ('Formato del mese scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if length (anno) < 4 then
|
||||
dbms_output.put_line ('Formato dell''anno scorretto');
|
||||
errore:=1;
|
||||
end if;
|
||||
|
||||
if errore = 1 then
|
||||
dbms_output.put_line ('ERRORE NEL FORMATO DEI PARAMETRI IN INPUT');
|
||||
else
|
||||
BEGIN
|
||||
|
||||
Directory_Output := 'REPORT_SLA';
|
||||
|
||||
-- il mese e l'anno di riferimento sono forniti in input
|
||||
mese_anno_riferimento := lpad(to_char(mese),2,0)||'/'||to_char(anno);
|
||||
|
||||
-- poi in versione numerica per i confronti nelle select
|
||||
mese_anno_rif_num := To_number(mese||anno);
|
||||
|
||||
Open C_Aom; -- mi estrae tutti gli AOM da trattare presenti in mnp_dw_donor
|
||||
|
||||
--- Inizio giro degli AOM
|
||||
|
||||
Loop Fetch c_aom Into V_aom_donor;
|
||||
Exit When C_Aom%NotFound;
|
||||
|
||||
-- costruisco il nome del file per AOM
|
||||
file_output := utl_file.fopen (directory_output, 'SLA_RECIPIENT_HOC_'||V_aom_donor||'_'||lpad(to_char(mese),2,0)||anno||'.csv', 'w');
|
||||
|
||||
-- scrivo l'intestazione della tabella
|
||||
UTL_FILE.put_line (file_output, 'RICHIESTE AD HOC: MESE/ANNO DI RIFERIMENTO: '||mese_anno_riferimento);
|
||||
UTL_FILE.put_line (file_output, 'AOM DONOR : '||V_aom_donor);
|
||||
|
||||
-- calcolo i totali delle linee in ritardo raggruppate per tipo_cliente (CO/BU)
|
||||
begin
|
||||
-- totali BU
|
||||
Select count (*)
|
||||
Into tot_BU_DONOR
|
||||
From DWH.MNP_DW_REC_HOC A,
|
||||
DWH.MNP_DW_REC_HOC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.tipo_linea = 'BU'
|
||||
And a.aom_donor = V_aom_donor
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_BU_TP
|
||||
From DWH.MNP_DW_REC_HOC_SLA_TERZEPARTI D,
|
||||
DWH.MNP_DW_REC_HOC E
|
||||
where e.id_richiesta = d.id_richiesta
|
||||
And d.aom_terze_parti = V_aom_donor
|
||||
And D.mese||D.anno = mese_anno_rif_num
|
||||
and e.tipo_linea = 'BU';
|
||||
|
||||
-- totali CO
|
||||
Select count (*)
|
||||
Into tot_CO_DONOR
|
||||
From DWH.MNP_DW_REC_HOC A,
|
||||
DWH.MNP_DW_REC_HOC_SLA B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.tipo_linea = 'CO'
|
||||
And a.aom_donor = V_aom_donor
|
||||
And b.mese||b.anno = mese_anno_rif_num;
|
||||
|
||||
Select count (*)
|
||||
Into tot_CO_TP
|
||||
From DWH.MNP_DW_REC_HOC_SLA_TERZEPARTI D,
|
||||
DWH.MNP_DW_REC_HOC E
|
||||
where e.id_richiesta = d.id_richiesta
|
||||
And d.aom_terze_parti = V_aom_donor
|
||||
And D.mese||D.anno = mese_anno_rif_num
|
||||
and e.tipo_linea = 'CO';
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo Linee BU/CO :'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
tot_BU := tot_BU_DONOR + tot_BU_TP;
|
||||
tot_CO := tot_CO_DONOR + tot_CO_TP;
|
||||
|
||||
-- calcolo il totale delle linee in ritardo
|
||||
Begin
|
||||
select count (*)
|
||||
Into tot_rec
|
||||
From DWH.MNP_DW_REC_HOC_SLA a,
|
||||
DWH.MNP_DW_REC_HOC b
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And a.mese||a.anno = mese_anno_rif_num
|
||||
And b.aom_donor = V_aom_donor;
|
||||
|
||||
select count (*)
|
||||
Into tot_tp
|
||||
From DWH.MNP_DW_REC_HOC_SLA_TERZEPARTI
|
||||
Where mese||anno = mese_anno_rif_num
|
||||
And aom_terze_parti = V_aom_donor;
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo Totale Linee in ritardo :'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
tot_ritardo := tot_rec + tot_tp;
|
||||
|
||||
-- riempio la terza riga dell'intestazione
|
||||
UTL_FILE.put_line (file_output, 'Totale linee in ritardo: '||tot_ritardo||';'||'Linee BU: '||tot_BU||';'||
|
||||
'Linee CO: '||tot_CO||';');
|
||||
|
||||
Begin
|
||||
-- riempimento dei campi dei totali richieste SLA (0-2) --> colonna di sinistra del Report
|
||||
-- DEVONO ESSERE CONTATI SINGOLARMENTE SOLO SE > 0
|
||||
Select count(sla_zero_minore)
|
||||
Into sla_0_min
|
||||
From DWH.MNP_DW_REC_HOC_SLA A,
|
||||
DWH.MNP_DW_REC_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_zero_minore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_zero_maggiore)
|
||||
into sla_0_max
|
||||
From DWH.MNP_DW_REC_HOC_SLA A,
|
||||
DWH.MNP_DW_REC_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_zero_maggiore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_uno_minore)
|
||||
Into sla_1_min
|
||||
From DWH.MNP_DW_REC_HOC_SLA A,
|
||||
DWH.MNP_DW_REC_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_uno_minore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_uno_maggiore)
|
||||
Into sla_1_max
|
||||
From DWH.MNP_DW_REC_HOC_SLA A,
|
||||
DWH.MNP_DW_REC_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_uno_maggiore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_due_minore)
|
||||
Into sla_2_min
|
||||
From DWH.MNP_DW_REC_HOC_SLA A,
|
||||
DWH.MNP_DW_REC_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_due_minore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
Select count(sla_due_maggiore)
|
||||
Into sla_2_max
|
||||
From DWH.MNP_DW_REC_HOC_SLA A,
|
||||
DWH.MNP_DW_REC_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And sla_due_maggiore > 0
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (0-2) --> colonna di destra del Report
|
||||
select nvl(sum(sla_zero_minore),0), nvl(sum(sla_zero_maggiore),0),
|
||||
nvl(sum(sla_uno_minore),0), nvl(sum(sla_uno_maggiore),0),
|
||||
nvl(sum(sla_due_minore),0), nvl(sum(sla_due_maggiore),0)
|
||||
into gg_sla_0_min, gg_sla_0_max,
|
||||
gg_sla_1_min, gg_sla_1_max,
|
||||
gg_sla_2_min, gg_sla_2_max
|
||||
From DWH.MNP_DW_REC_HOC_SLA A,
|
||||
DWH.MNP_DW_REC_HOC B
|
||||
Where a.id_richiesta = b.id_richiesta
|
||||
And b.aom_donor = V_aom_donor
|
||||
And mese||anno = mese_anno_rif_num;
|
||||
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali richieste SLA (0-2):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
Begin
|
||||
-- riempimento dei campi dei totali richieste SLA (3) --> colonna di sinistra del Report
|
||||
|
||||
-- Anche questi vanno calcolati singolarmente solo se > 0
|
||||
|
||||
Select Count(Sla_Tre_Minore)
|
||||
Into sla_3_min
|
||||
From DWH.MNP_DW_REC_HOC_SLA_TERZEPARTI A,
|
||||
DWH.MNP_DW_REC_HOC_TERZEPARTI B
|
||||
Where A.Id_Richiesta = B.Id_Richiesta
|
||||
And B.aom_terze_parti = a.aom_terze_parti
|
||||
And b.aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Minore > 0;
|
||||
|
||||
Select Count(Sla_Tre_Maggiore)
|
||||
Into sla_3_max
|
||||
From DWH.MNP_DW_REC_HOC_SLA_TERZEPARTI A,
|
||||
DWH.MNP_DW_REC_HOC_TERZEPARTI B
|
||||
Where A.Id_Richiesta = B.Id_Richiesta
|
||||
And B.aom_terze_parti = a.aom_terze_parti
|
||||
And b.aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num
|
||||
And Sla_Tre_Maggiore > 0;
|
||||
|
||||
-- riempimento dei campi dei totali giorni SLA (3) --> colonna di destra del Report
|
||||
Select nvl(sum(sla_tre_minore),0),
|
||||
nvl(sum(sla_tre_maggiore),0)
|
||||
Into gg_sla_3_min,
|
||||
gg_sla_3_max
|
||||
From DWH.MNP_DW_REC_HOC_SLA_TERZEPARTI A,
|
||||
DWH.MNP_DW_REC_HOC_TERZEPARTI B
|
||||
Where A.Id_Richiesta = B.Id_Richiesta
|
||||
And B.aom_terze_parti = a.aom_terze_parti
|
||||
And b.aom_terze_parti = V_aom_donor
|
||||
And Mese||Anno = Mese_Anno_Rif_Num;
|
||||
|
||||
Exception When Others Then
|
||||
dbms_output.put_line ('ERRORE in calcolo totali richieste SLA (3):'||sqlerrm);
|
||||
Close c_aom; -- chiudo il cursore
|
||||
UTL_FILE.fflush(file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file
|
||||
exit;
|
||||
End;
|
||||
|
||||
-- costruisco le linee di dettaglio del report con i valori appena estratti
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 <=4: '||sla_0_min||';'||'Totale SLA0 <=4: '||gg_sla_0_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA0 >4: '||sla_0_max||';'||'Totale SLA0 >4: '||gg_sla_0_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 <=4: '||sla_1_min||';'||'Totale SLA1 <=4: '||gg_sla_1_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA1 >4: '||sla_1_max||';'||'Totale SLA1 >4: '||gg_sla_1_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 <=4: '||sla_2_min||';'||'Totale SLA2 <=4: '||gg_sla_2_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA2 >4: '||sla_2_max||';'||'Totale SLA2 >4: '||gg_sla_2_max||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA3 <=4: '||sla_3_min||';'||'Totale SLA3 <=4: '||gg_sla_3_min||';');
|
||||
UTL_FILE.put_line(file_output,
|
||||
'Totale Richieste SLA3 >4: '||sla_3_max||';'||'Totale SLA3 >4: '||gg_sla_3_max||';');
|
||||
|
||||
-- chiudo il file per operatore
|
||||
UTL_FILE.fflush (file_output); -- svuoto i dati
|
||||
UTL_FILE.fclose(file_output); -- chiudo il file e buonanotte all'aom
|
||||
|
||||
End Loop; -- fine del loop del cursore c_aom (V_aom_donor)
|
||||
|
||||
--- FINE giro degli AOM
|
||||
|
||||
CLOSE c_aom;
|
||||
|
||||
EXCEPTION
|
||||
When UTL_FILE.INVALID_PATH Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
|
||||
When UTL_FILE.INVALID_MODE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_MODE');
|
||||
When UTL_FILE.INVALID_FILEHANDLE Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_FILEHANDLE');
|
||||
When UTL_FILE.INVALID_OPERATION Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_OPERATION');
|
||||
When UTL_FILE.READ_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.READ_ERROR');
|
||||
When UTL_FILE.WRITE_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.WRITE_ERROR');
|
||||
When UTL_FILE.INTERNAL_ERROR Then
|
||||
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INTERNAL_ERROR');
|
||||
When OTHERS Then
|
||||
DBMS_OUTPUT.PUT_LINE(SQLERRM);
|
||||
END;
|
||||
|
||||
end if; -- fine del controllo per errore = 1 (errore nel formato dei parametri in input)
|
||||
|
||||
END;
|
||||
/
|
||||
exit
|
||||
@@ -0,0 +1,109 @@
|
||||
SET serveroutput on
|
||||
|
||||
DECLARE
|
||||
|
||||
|
||||
|
||||
operatore varchar2(10);
|
||||
|
||||
errore exception;
|
||||
|
||||
rich_mese_pre_prp number(6);
|
||||
dir_out varchar2(255);
|
||||
di varchar2(20);
|
||||
df varchar2(20);
|
||||
ut varchar2(20);
|
||||
p varchar2(255):='&1';
|
||||
|
||||
|
||||
CURSOR cur_operatori is
|
||||
SELECT desc_olo
|
||||
FROM mnp_olo_report
|
||||
where flag_attivo = 1
|
||||
and desc_olo not in ('TIMT', 'TIMG')
|
||||
order by desc_olo;
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
if (p <> 'nullo')then
|
||||
|
||||
di := to_date('&1','dd/mm/yyyy');
|
||||
df := to_date('&2','dd/mm/yyyy');
|
||||
dir_out:='&3';
|
||||
else
|
||||
di := '&1';
|
||||
df := '&2';
|
||||
|
||||
select recipient_out into dir_out
|
||||
from mnp_olo_report
|
||||
where desc_olo = 'MONIT';
|
||||
|
||||
end if;
|
||||
|
||||
OPEN cur_operatori;
|
||||
|
||||
LOOP
|
||||
FETCH cur_operatori INTO operatore;
|
||||
EXIT WHEN cur_operatori%NOTFOUND;
|
||||
|
||||
declare
|
||||
|
||||
cod varchar2(23);
|
||||
msisdn varchar2(15);
|
||||
descr_stato varchar2(40);
|
||||
data_val DATE;
|
||||
data_co DATE;
|
||||
file1 UTL_FILE.file_type;
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select r.id_richiesta,r.msisdn,sr.descr_stato,r.data_validazione_eff,r.data_cut_over_calc
|
||||
from mnp_gestione_richiesta_rec r, mnp_stato_rec sr,
|
||||
mnp_xml_in x1, mnp_xml_richiesta_in xr1
|
||||
where r.id_richiesta = xr1.id_richiesta
|
||||
and r.stato=sr.id_stato
|
||||
and xr1.nome_file = x1.nome_file
|
||||
and x1.tipo_file=2
|
||||
and r.codice_operatore_donating = operatore
|
||||
and trunc(r.data_validazione_eff) <= decode(di,'nullo',trunc(sysdate-1),to_date(di,'dd-MON-yy'))
|
||||
and trunc(r.data_validazione_eff) >= decode(df,'nullo',trunc(r.data_validazione_eff),to_date(df,'dd-MON-yy'))
|
||||
and r.id_richiesta not in (
|
||||
select r.id_richiesta
|
||||
from mnp_gestione_richiesta_rec r,
|
||||
mnp_xml_in x2, mnp_xml_richiesta_in xr2
|
||||
where r.id_richiesta = xr2.id_richiesta
|
||||
and xr2.nome_file = x2.nome_file
|
||||
and x2.tipo_file=5
|
||||
);
|
||||
|
||||
begin
|
||||
|
||||
file1 := UTL_FILE.fopen (dir_out, upper(operatore)|| '_to_TIM_validazNoPreseincar_'||to_char(sysdate,'yyyyMMdd')||'.csv', 'w');
|
||||
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn; Operatore Donating; Data Validazione Effettiva; Data Cut-Over Calcolata;');
|
||||
UTL_FILE.put_line (file1,' ');
|
||||
|
||||
OPEN cur_res;
|
||||
LOOP
|
||||
FETCH cur_res INTO cod,msisdn,descr_stato,data_val,data_co;
|
||||
EXIT WHEN cur_res%NOTFOUND;
|
||||
|
||||
UTL_FILE.put_line (file1,cod ||';'|| msisdn ||';'|| descr_stato ||';'|| data_val ||';'|| data_co ||';');
|
||||
END LOOP;
|
||||
CLOSE cur_res;
|
||||
UTL_FILE.fflush (file1);
|
||||
UTL_FILE.fclose (file1);
|
||||
end;
|
||||
END LOOP;
|
||||
CLOSE cur_operatori;
|
||||
|
||||
exception
|
||||
--when errore then
|
||||
-- DBMS_OUTPUT.PUT_LINE('La data inserita è null');
|
||||
when others then
|
||||
DBMS_OUTPUT.PUT_LINE(sqlerrm);
|
||||
|
||||
END;
|
||||
/
|
||||
exit;
|
||||
Reference in New Issue
Block a user