1333 lines
52 KiB
SQL
1333 lines
52 KiB
SQL
|
|
CREATE OR REPLACE
|
|
PACKAGE svecchiamento_dbcgo
|
|
IS
|
|
|
|
PROCEDURE old_dbcgo_gest_rich (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_por (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_rec (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_r_tc (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_tc (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_don_virt (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_rec_virt (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_ges_ric_rec_virt_m2m (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_ric_don_virt_tc (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_ric_rec_virt_tc (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_gest_ric_rv_m2m_tc (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
PROCEDURE old_dbcgo_richieste_processate (path_file in varchar2, anno_mese in varchar2);
|
|
|
|
END; -- Package spec
|
|
/
|
|
|
|
|
|
CREATE OR REPLACE
|
|
PACKAGE BODY svecchiamento_dbcgo
|
|
IS
|
|
|
|
PROCEDURE old_dbcgo_gest_rich (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
nome_file varchar2(100);
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_rich is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.stato||'|'||
|
|
a.tipo_cliente||'|'||
|
|
a.data_cut_over_calc||'|'||
|
|
a.data_validazione_max||'|'||
|
|
a.dataricezionerichiesta||'|'||
|
|
a.data_cut_over||'|'||
|
|
a.codice_operatore_recipient||'|'||
|
|
a.msisdn||'|'||
|
|
a.codice_fiscale_partita_iva||'|'||
|
|
a.codice_pre_post_pagato||'|'||
|
|
a.nome_cliente||'|'||
|
|
a.cognome_cliente||'|'||
|
|
a.ragione_sociale||'|'||
|
|
a.richiestaadhocaom||'|'||
|
|
a.richiestaadhoc||'|'||
|
|
a.marcaggio||'|'||
|
|
a.sottomarcaggio||'|'||
|
|
a.id_priorita||'|'||
|
|
a.insert_date||'|'||
|
|
a.update_date||'|'||
|
|
a.codice_gruppo||'|'||
|
|
a.iccd_serial_number||'|'||
|
|
a.imsi||'|'||
|
|
a.ipotesi_rifiuto||'|'||
|
|
a.numero_documento||'|'||
|
|
a.tipo_documento||'|'||
|
|
a.timestamp||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.nome_ot_geo||'|'||
|
|
a.nome_ot_leg||'|'||
|
|
a.id_priorita_mnp||'|'||
|
|
a.data_transizione_stato_grp||'|'||
|
|
a.codice_operatore_donating||'|'||
|
|
a.stato_linea||'|'||
|
|
a.flag_tc||'|'||
|
|
a.data_presa_in_carico||'|'||
|
|
a.codice_operatore_v_donor||'|'||
|
|
a.codice_operatore_v_recipient||'|'||
|
|
a.prevalidazione||'|'||
|
|
a.flag_furto||'|'||
|
|
a.flag_prevalidazione||'|'||
|
|
a.codice_rifiuto_validazione||'|'||
|
|
a.abbonato_prepagato||'|'||
|
|
a.descrizione_esito_gisp||'|'||
|
|
a.esito_cas||'|'
|
|
FROM dbcgo_gestione_richiesta a
|
|
WHERE to_char(a.dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_'||anno_mese||'.dat');
|
|
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gestione_richiesta');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gestione_richiesta where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
delete from dbcgo_gestione_richiesta where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gestione_richiesta where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gestione_richiesta, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_por (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_rich_por is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.stato||'|'||
|
|
a.dataricezionerichiesta||'|'||
|
|
a.data_cut_over||'|'||
|
|
a.codice_operatore_donating||'|'||
|
|
a.codice_operatore_recipient||'|'||
|
|
a.msisdn||'|'||
|
|
a.insert_date||'|'||
|
|
a.update_date||'|'||
|
|
a.timestamp||'|'||
|
|
a.data_transizione_stato||'|'
|
|
FROM dbcgo_gestione_richiesta_por a
|
|
WHERE to_char(a.dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich_por '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_por_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich_por '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_por'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_por_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_por_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich_por;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich_por
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich_por%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich_por;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_por_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_por_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gestione_richiesta_por');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gestione_richiesta_por where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
delete from dbcgo_gestione_richiesta_por where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gestione_richiesta_por where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gestione_richiesta_por, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich_por '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich_por '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich_por terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich_por terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_rec (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_rich_rec is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.stato||'|'||
|
|
a.tipo_cliente||'|'||
|
|
a.data_cut_over_calc||'|'||
|
|
a.data_validazione_max||'|'||
|
|
a.dataricezionerichiesta||'|'||
|
|
a.data_cut_over||'|'||
|
|
a.codice_operatore_donating||'|'||
|
|
a.msisdn||'|'||
|
|
a.codice_fiscale_partita_iva||'|'||
|
|
a.codice_pre_post_pagato||'|'||
|
|
a.nome_cliente||'|'||
|
|
a.cognome_cliente||'|'||
|
|
a.ragione_sociale||'|'||
|
|
a.causale_accodamento||'|'||
|
|
a.richiestaadhoc||'|'||
|
|
a.richiestaadhocaom||'|'||
|
|
a.id_priorita||'|'||
|
|
a.insert_date||'|'||
|
|
a.update_date||'|'||
|
|
a.iccd_serial_number||'|'||
|
|
a.imsi||'|'||
|
|
a.nome_ot||'|'||
|
|
a.numero_documento||'|'||
|
|
a.tipo_documento||'|'||
|
|
a.numero_invii||'|'||
|
|
a.timestamp||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.id_priorita_mnp||'|'||
|
|
a.data_transizione_stato_grp||'|'||
|
|
a.codice_dealer||'|'||
|
|
a.car1||'|'||
|
|
a.car2||'|'||
|
|
a.codice_operatore_recipient||'|'||
|
|
a.codice_gruppo||'|'||
|
|
a.sistema_mittente||'|'||
|
|
a.cod_profilo_tariffario||'|'||
|
|
a.cod_offerta||'|'||
|
|
a.cod_accordo||'|'||
|
|
a.descanale_vendita_bu||'|'||
|
|
a.cod_canale||'|'||
|
|
a.codice_ordine||'|'||
|
|
a.tipo_operazione||'|'||
|
|
a.flag_tc||'|'||
|
|
a.data_presa_in_carico||'|'||
|
|
a.codice_operatore_v_donor||'|'||
|
|
a.codice_operatore_v_recipient||'|'||
|
|
a.flag_furto||'|'||
|
|
a.flag_prevalidazione||'|'||
|
|
a.codici_rifiuto_validazione||'|'||
|
|
a.data_acquisizione||'|'
|
|
FROM dbcgo_gestione_richiesta_rec a
|
|
WHERE to_char(a.dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich_rec '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_rec_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich_rec '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_rec_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_rec_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_rec_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich_rec;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich_rec
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich_rec%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich_rec;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_rec_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_rec_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gestione_richiesta_rec');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gestione_richiesta_rec where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
delete from dbcgo_gestione_richiesta_rec where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gestione_richiesta_rec where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gestione_richiesta_rec, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich_rec '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich_rec '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich_rec terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich_rec terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_r_tc (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_rich_r_tc is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_notifica_credito||'|'||
|
|
a.ora_notifica_credito||'|'||
|
|
a.stato||'|'||
|
|
a.importo||'|'||
|
|
a.nome_file_aom||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.data_ora_modifica||'|'
|
|
FROM dbcgo_gestione_richiesta_r_tc a, dbcgo_gestione_richiesta_rec b
|
|
WHERE to_char(b.dataricezionerichiesta,'yyyymm') = anno_mese
|
|
and b.id_richiesta = a.id_richiesta;
|
|
|
|
-- vedere se ok data_notifica_credito
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich_r_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_r_tc_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich_r_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_r_tc_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_r_tc_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_r_tc_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich_r_tc;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich_r_tc
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich_r_tc%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich_r_tc;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_r_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_r_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_rich_r_tc');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gestione_richiesta_r_tc where id_richiesta in (select id_richiesta from dbcgo_gestione_richiesta_rec where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
delete from dbcgo_gestione_richiesta_r_tc where id_richiesta in (select id_richiesta from dbcgo_gestione_richiesta_rec where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gestione_richiesta_r_tc where id_richiesta in (select id_richiesta from dbcgo_gestione_richiesta_rec where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gestione_richiesta_r_tc, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich_r_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich_r_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich_r_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich_r_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_tc (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_rich_tc is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_notifica_credito||'|'||
|
|
a.ora_notifica_credito||'|'||
|
|
a.stato||'|'||
|
|
a.importo||'|'||
|
|
a.nome_file_aom||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.data_ora_modifica||'|'
|
|
FROM dbcgo_gestione_richiesta_tc a, dbcgo_gestione_richiesta b
|
|
WHERE to_char(b.dataricezionerichiesta,'yyyymm') = anno_mese
|
|
and a.id_richiesta = b.id_richiesta;
|
|
|
|
-- vedere se ok data_notifica_credito
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_tc_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_tc_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_tc_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_tc_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich_tc;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich_tc
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich_tc%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich_tc;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_rich_tc');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gestione_richiesta_tc where id_richiesta in (select id_richiesta from dbcgo_gestione_richiesta where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
delete from dbcgo_gestione_richiesta_tc where id_richiesta in (select id_richiesta from dbcgo_gestione_richiesta where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gestione_richiesta_tc where id_richiesta in (select id_richiesta from dbcgo_gestione_richiesta where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gestione_richiesta_tc, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_don_virt (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
|
|
CURSOR cur_gest_rich_don_virt is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_inserimento||'|'||
|
|
a.data_ora_modifica||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.stato||'|'||
|
|
a.tipo_cliente||'|'||
|
|
a.data_cut_over_calc||'|'||
|
|
a.data_validazione_max||'|'||
|
|
a.dataricezionerichiesta||'|'||
|
|
a.data_cut_over||'|'||
|
|
a.codice_operatore_donating||'|'||
|
|
a.codice_operatore_recipient||'|'||
|
|
a.msisdn||'|'||
|
|
a.codice_fiscale_partita_iva||'|'||
|
|
a.codice_pre_post_pagato||'|'||
|
|
a.nome_cliente||'|'||
|
|
a.cognome_cliente||'|'||
|
|
a.ragione_sociale||'|'||
|
|
a.iccd_serial_number||'|'||
|
|
a.nome_ot||'|'||
|
|
a.numero_documento||'|'||
|
|
a.tipo_documento||'|'||
|
|
a.flag_tc||'|'||
|
|
a.codicerifiutovalidazione||'|'||
|
|
a.business_id_don||'|'||
|
|
a.flag_furto||'|'||
|
|
a.flag_prevalidazione||'|'||
|
|
a.prevalidazione||'|'||
|
|
a.flag_esp||'|'||
|
|
a.data_validazione_eff||'|'||
|
|
a.sistema_mitt||'|'||
|
|
a.codice_dealer||'|'||
|
|
a.cod_profilo_tariffario||'|'||
|
|
a.desc_profilo_tariffario||'|'||
|
|
a.data_presa_in_carico||'|'||
|
|
a.data_acquisizione||'|'
|
|
FROM dbcgo_gest_rich_don_virt a
|
|
WHERE to_char(a.dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich_don_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_don_virt_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich_don_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_don_virt_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_don_virt_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_don_virt_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich_don_virt;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich_don_virt
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich_don_virt%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich_don_virt;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_don_virt_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_don_virt_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_rich_don_virt');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gest_rich_don_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
delete from dbcgo_gest_rich_don_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gest_rich_don_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gest_rich_don_virt, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich_don_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich_don_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich_don_virt terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich_don_virt terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_rich_rec_virt (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_rich_rec_virt is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_ora_modifica||'|'||
|
|
a.data_inserimento||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.stato||'|'||
|
|
a.tipo_cliente||'|'||
|
|
a.data_cut_over_calc||'|'||
|
|
a.data_validazione_max||'|'||
|
|
a.dataricezionerichiesta||'|'||
|
|
a.data_cut_over||'|'||
|
|
a.codicerifiutovalidazione||'|'||
|
|
a.codice_operatore_recipient||'|'||
|
|
a.msisdn||'|'||
|
|
a.codice_fiscale_partita_iva||'|'||
|
|
a.codice_pre_post_pagato||'|'||
|
|
a.nome_cliente||'|'||
|
|
a.cognome_cliente||'|'||
|
|
a.ragione_sociale||'|'||
|
|
a.marcaggio||'|'||
|
|
a.sottomarcaggio||'|'||
|
|
a.iccd_serial_number||'|'||
|
|
a.numero_documento||'|'||
|
|
a.tipo_documento||'|'||
|
|
a.nome_ot_geo||'|'||
|
|
a.nome_ot_leg||'|'||
|
|
a.codice_operatore_donating||'|'||
|
|
a.flag_tc||'|'||
|
|
a.prevalidazione||'|'||
|
|
a.data_validazione_eff||'|'||
|
|
a.business_id_rec||'|'||
|
|
a.flag_esp||'|'||
|
|
a.flag_furto||'|'||
|
|
a.flag_prevalidazione||'|'||
|
|
a.abbonato_prepagato||'|'||
|
|
a.descrizione_esito_gisp||'|'||
|
|
a.esito_cas||'|'||
|
|
a.data_presa_in_carico||'|'||
|
|
a.data_acquisizione||'|'
|
|
FROM dbcgo_gest_rich_rec_virt a
|
|
WHERE to_char(a.dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich_rec_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_rec_virt_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich_rec_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_rec_virt_'||anno_mese||'.dat');
|
|
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_rec_virt_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_rec_virt_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich_rec_virt;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich_rec_virt
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich_rec_virt%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich_rec_virt;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_rec_virt_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_rec_virt_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_rich_rec_virt');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gest_rich_rec_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
delete from dbcgo_gest_rich_rec_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gest_rich_rec_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gest_rich_rec_virt, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich_rec_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich_rec_virt '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich_rec_virt terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich_rec_virt terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_ges_ric_rec_virt_m2m (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_rich_rec_virt_m2m is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_ora_modifica||'|'||
|
|
a.data_inserimento||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.stato||'|'||
|
|
a.tipo_cliente||'|'||
|
|
a.data_cut_over_calc||'|'||
|
|
a.data_validazione_max||'|'||
|
|
a.dataricezionerichiesta||'|'||
|
|
a.data_cut_over||'|'||
|
|
a.codicerifiutovalidazione||'|'||
|
|
a.codice_operatore_recipient||'|'||
|
|
a.msisdn||'|'||
|
|
a.codice_fiscale_partita_iva||'|'||
|
|
a.codice_pre_post_pagato||'|'||
|
|
a.nome_cliente||'|'||
|
|
a.cognome_cliente||'|'||
|
|
a.ragione_sociale||'|'||
|
|
a.iccd_serial_number||'|'||
|
|
a.numero_documento||'|'||
|
|
a.tipo_documento||'|'||
|
|
a.codice_operatore_donating||'|'||
|
|
a.flag_tc||'|'||
|
|
a.prevalidazione||'|'||
|
|
a.data_validazione_eff||'|'||
|
|
a.business_id_rec||'|'||
|
|
a.business_id_don||'|'||
|
|
a.flag_furto||'|'||
|
|
a.flag_prevalidazione||'|'||
|
|
a.data_presa_in_carico||'|'||
|
|
a.data_acquisizione||'|'
|
|
FROM dbcgo_gest_rich_rec_virt_m2m a
|
|
WHERE to_char(a.dataricezionerichiesta,'yyyymm') = anno_mese;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_rich_rec_virt_m2m '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_rec_virt_m2m_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_rich_rec_virt_m2m '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_rich_rec_virt_m2m_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_rich_rec_virt_m2m_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_rich_rec_virt_m2m_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_rich_rec_virt_m2m;
|
|
|
|
LOOP
|
|
FETCH cur_gest_rich_rec_virt_m2m
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_rich_rec_virt_m2m%NOTFOUND;
|
|
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_rich_rec_virt_m2m;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_rich_rec_virt_m2m_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_rich_rec_virt_m2m_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_rich_rec_virt_m2m');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gest_rich_rec_virt_m2m where to_char(dataricezionerichiesta,'yyyy') = anno_mese;
|
|
|
|
delete from dbcgo_gest_rich_rec_virt_m2m where to_char(dataricezionerichiesta,'yyyy') = anno_mese;
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gest_rich_rec_virt_m2m where to_char(dataricezionerichiesta,'yyyy') = anno_mese;
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gest_rich_rec_virt_m2m, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_rich_rec_virt_m2m '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_rich_rec_virt_m2m '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_rich_rec_virt_m2m terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_rich_rec_virt_m2m terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_ric_don_virt_tc (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_ric_don_virt_tc is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_notifica_credito||'|'||
|
|
a.ora_notifica_credito||'|'||
|
|
a.stato||'|'||
|
|
a.importo||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.data_ora_modifica||'|'
|
|
FROM dbcgo_gest_ric_don_virt_tc a, dbcgo_gest_rich_don_virt b
|
|
WHERE to_char(b.dataricezionerichiesta,'yyyymm') = anno_mese
|
|
and a.id_richiesta = b.id_richiesta;
|
|
|
|
BEGIN
|
|
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_ric_don_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_ric_don_virt_tc_'||to_char(sysdate,'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_ric_don_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_ric_don_virt_tc_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_ric_don_virt_tc_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_ric_don_virt_tc_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_ric_don_virt_tc;
|
|
|
|
LOOP
|
|
FETCH cur_gest_ric_don_virt_tc
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_ric_don_virt_tc%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_ric_don_virt_tc;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_ric_don_virt_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_ric_don_virt_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_ric_don_virt_tc');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gest_ric_don_virt_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_don_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
delete from dbcgo_gest_ric_don_virt_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_don_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gest_ric_don_virt_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_don_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gest_ric_don_virt_tc, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_ric_don_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_ric_don_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_ric_don_virt_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_ric_don_virt_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_ric_rec_virt_tc (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_ric_rec_virt_tc is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_notifica_credito||'|'||
|
|
a.ora_notifica_credito||'|'||
|
|
a.stato||'|'||
|
|
a.importo||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.data_ora_modifica||'|'
|
|
FROM dbcgo_gest_ric_rec_virt_tc a, dbcgo_gest_rich_rec_virt b
|
|
WHERE to_char(b.dataricezionerichiesta,'yyyymm') = anno_mese
|
|
and a.id_richiesta = b.id_richiesta;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_ric_rec_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_ric_rec_virt_tc_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_ric_rec_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_ric_rec_virt_tc_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_ric_rec_virt_tc_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_ric_rec_virt_tc_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_ric_rec_virt_tc;
|
|
|
|
LOOP
|
|
FETCH cur_gest_ric_rec_virt_tc
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_ric_rec_virt_tc%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_ric_rec_virt_tc;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine scrittura file old_dbcgo_gest_ric_rec_virt_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_ric_rec_virt_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_ric_rec_virt_tc');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gest_ric_rec_virt_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_rec_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
delete from dbcgo_gest_ric_rec_virt_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_rec_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gest_ric_rec_virt_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_rec_virt where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gest_ric_rec_virt_tc, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_ric_rec_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_ric_rec_virt_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_ric_rec_virt_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_ric_rec_virt_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_gest_ric_rv_m2m_tc (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_gest_ric_rv_m2m_tc is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.data_notifica_credito||'|'||
|
|
a.ora_notifica_credito||'|'||
|
|
a.stato||'|'||
|
|
a.importo||'|'||
|
|
a.data_transizione_stato||'|'||
|
|
a.data_ora_modifica||'|'
|
|
FROM dbcgo_gest_ric_rv_m2m_tc a, dbcgo_gest_rich_rec_virt_m2m b
|
|
WHERE to_char(b.dataricezionerichiesta,'yyyymm') = anno_mese
|
|
and a.id_richiesta = b.id_richiesta;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura old_dbcgo_gest_ric_rv_m2m_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_ric_rv_m2m_tc_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura old_dbcgo_gest_ric_rv_m2m_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_gest_ric_rv_m2m_tc_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_gest_ric_rv_m2m_tc_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_gest_ric_rv_m2m_tc_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_gest_ric_rv_m2m_tc;
|
|
|
|
LOOP
|
|
FETCH cur_gest_ric_rv_m2m_tc
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_gest_ric_rv_m2m_tc%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_gest_ric_rv_m2m_tc;
|
|
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_gest_ric_rv_m2m_tc_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_gest_ric_rv_m2m_tc');
|
|
|
|
select count(*) into n_rec_in from dbcgo_gest_ric_rv_m2m_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_rec_virt_m2m where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
delete from dbcgo_gest_ric_rv_m2m_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_rec_virt_m2m where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
commit;
|
|
|
|
select count(*) into n_rec_fin from dbcgo_gest_ric_rv_m2m_tc where id_richiesta in (select id_richiesta from dbcgo_gest_rich_rec_virt_m2m where to_char(dataricezionerichiesta,'yyyymm') = anno_mese);
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_gest_ric_rv_m2m_tc, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_gest_ric_rv_m2m_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_gest_ric_rv_m2m_tc '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_gest_ric_rv_m2m_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_gest_ric_rv_m2m_tc terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
PROCEDURE old_dbcgo_richieste_processate (path_file in varchar2, anno_mese in varchar2)
|
|
IS
|
|
|
|
puntatore_file SYS.UTL_FILE.FILE_TYPE;
|
|
puntatore_file_log SYS.UTL_FILE.FILE_TYPE;
|
|
tutto varchar2(1000);
|
|
sql_msg varchar2(1000);
|
|
sql_code integer;
|
|
n_rec_in integer;
|
|
n_rec_fin integer;
|
|
n_rec_del integer;
|
|
|
|
CURSOR cur_richieste_processate is
|
|
SELECT a.id_richiesta||'|'||
|
|
a.msisdn||'|'||
|
|
a.processo||'|'||
|
|
a.stato_finale||'|'||
|
|
a.data_pic||'|'||
|
|
a.data_val||'|'||
|
|
a.dco||'|'||
|
|
a.data_chiusura_processo||'|'||
|
|
a.data_attivita_rete||'|'||
|
|
a.id_correlazione||'|'||
|
|
a.operatore_don||'|'||
|
|
a.operatore_rec||'|'||
|
|
a.operatore_don_eff||'|'||
|
|
a.operatore_rec_eff||'|'||
|
|
a.tipo_cliente||'|'||
|
|
a.codice_fiscale||'|'||
|
|
a.codici_rifiuto_validazione||'|'
|
|
FROM dbcgo_richieste_processate a
|
|
WHERE to_char(a.data_chiusura_processo,'yyyymm') = anno_mese;
|
|
|
|
BEGIN
|
|
|
|
DBMS_OUTPUT.put_line ('Inizio Procedura dbcgo_richieste_processate '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
puntatore_file_log := UTL_FILE.FOPEN(path_file,'old_dbcgo_richieste_processate_'||to_char(sysdate, 'ddmmyyyy_hh24miss')||'.log','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Procedura dbcgo_richieste_processate '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss'));
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Apertura file old_dbcgo_richieste_processate_'||anno_mese||'.dat');
|
|
|
|
--puntatore_file := UTL_FILE.FOPEN('E:\Oracle\oradata','prova.txt','w');
|
|
puntatore_file := UTL_FILE.FOPEN(path_file,'old_dbcgo_richieste_processate_'||anno_mese||'.dat','w');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio scrittura file old_dbcgo_richieste_processate_'||anno_mese||'.dat');
|
|
|
|
OPEN cur_richieste_processate;
|
|
|
|
LOOP
|
|
FETCH cur_richieste_processate
|
|
INTO
|
|
tutto;
|
|
|
|
EXIT WHEN cur_richieste_processate%NOTFOUND;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file, tutto);
|
|
|
|
END LOOP;
|
|
CLOSE cur_richieste_processate;
|
|
|
|
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file);
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Chiusura file old_dbcgo_richieste_processate_'||anno_mese||'.dat');
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Inizio Delete tabella dbcgo_richieste_processate');
|
|
|
|
select count(*) into n_rec_in from dbcgo_richieste_processate where to_char(data_chiusura_processo,'yyyymm') = anno_mese;
|
|
|
|
delete from dbcgo_richieste_processate where to_char(data_chiusura_processo,'yyyymm') = anno_mese;
|
|
commit;
|
|
|
|
select count(*) into n_rec_in from dbcgo_richieste_processate where to_char(data_chiusura_processo,'yyyymm') = anno_mese;
|
|
|
|
n_rec_del := n_rec_in - n_rec_fin;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Delete tabella dbcgo_richieste_processate, eliminati '||n_rec_del||' record');
|
|
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Fine Procedura old_dbcgo_richieste_processate '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
|
|
DBMS_OUTPUT.put_line ('Fine Procedura old_dbcgo_richieste_processate '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
sql_msg := sqlerrm;
|
|
sql_code := sqlcode;
|
|
ROLLBACK;
|
|
SYS.UTL_FILE.PUT_LINE(puntatore_file_log, 'Procedura old_dbcgo_richieste_processate terminata con errore '||to_char(sysdate, 'dd/mm/yyyy_hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
SYS.UTL_FILE.FCLOSE(puntatore_file_log);
|
|
DBMS_OUTPUT.put_line ('Procedura old_dbcgo_richieste_processate terminata con errore '||to_char(sysdate, 'dd/mm/yyyy hh24:mi:ss')||' sqlmsg: '||sql_msg||' - sqlcode: '||sql_code);
|
|
|
|
END; -- Procedure
|
|
|
|
|
|
END;
|
|
/
|
|
|
|
|