Files
2024-05-13 12:54:14 +02:00

76 lines
2.1 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* Formatted on 2006/01/12 18:11 (Formatter Plus v4.8.0) */
--Lindicatore deve riportare il numero totale di file ACK del giorno ancora non inviati da TIM verso AOM
--(senza alcuna aggregazione).
SET serveroutput on
DECLARE
valore VARCHAR2 (255);
data_val DATE;
file1 UTL_FILE.file_type;
freq VARCHAR2 (255) := '&1';
CURSOR cur_valore
IS
SELECT COUNT (nome_file), SYSDATE
FROM mnp_xml_out PARTITION (&2)
WHERE tipo_file = 8
AND TRUNC (data_eff) = TRUNC (SYSDATE)
AND data_invio IS NULL;
BEGIN
DBMS_OUTPUT.put_line ( 'apro il file '
|| 'MNP'
|| '.'
|| TO_CHAR (SYSDATE, 'yyyyMMdd')
);
file1 :=
UTL_FILE.fopen ('&3', 'MNP' || '.' || TO_CHAR (SYSDATE, 'yyyyMMdd'),
'a');
OPEN cur_valore;
LOOP
FETCH cur_valore
INTO valore, data_val;
EXIT WHEN cur_valore%NOTFOUND;
UTL_FILE.put_line (file1,
'SACKOU001'
|| ';;'
|| valore
|| ';'
|| freq
|| ';'
|| '&4'
|| ';'
|| TO_CHAR (data_val, 'yyyymmdd')
|| ';'
|| TO_CHAR (data_val, 'hh24:mi:ss')
|| ';'
|| TO_CHAR (SYSDATE, 'yyyymmdd')
|| ';'
|| TO_CHAR (SYSDATE, 'hh24:mi:ss')
|| ';'
|| '0'
|| ';;;'
);
END LOOP;
CLOSE cur_valore;
UTL_FILE.fflush (file1);
UTL_FILE.fclose (file1);
DBMS_OUTPUT.put_line ( 'chiudo il file '
|| 'MNP'
|| '.'
|| TO_CHAR (SYSDATE, 'yyyyMMdd')
);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
END;
/
EXIT