First Commit - Source Code from Reply
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user