First Commit - Source Code from Reply
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
CREATE OR REPLACE FUNCTION report_cessazione RETURN VARCHAR2 IS
|
||||
|
||||
rs varchar2(255);
|
||||
file1 UTL_FILE.file_type;
|
||||
path varchar2(255);
|
||||
filename varchar2(255);
|
||||
|
||||
|
||||
CURSOR cur_res is
|
||||
select b.codice_richiesta_recipient || ';' || b.msisdn
|
||||
from mnp_gestione_richiesta_cess b
|
||||
where b.stato = 1
|
||||
and b.da_processare = 1
|
||||
and tim_donor =1;
|
||||
|
||||
BEGIN
|
||||
select directory_path
|
||||
into path
|
||||
from all_directories
|
||||
where directory_name='PATH_REPORT_CESS';
|
||||
filename := 'CESSAZIONI_'||to_char(sysdate,'yyyyMMddhh24miss')||'.txt';
|
||||
file1 := UTL_FILE.fopen ('PATH_REPORT_CESS',filename, 'w');
|
||||
UTL_FILE.put_line (file1,'Codice richiesta; Msisdn');
|
||||
|
||||
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);
|
||||
return path||'/'||filename;
|
||||
END;
|
||||
/
|
||||
Reference in New Issue
Block a user