--L'indicatore deve riportare il numero totale di notifiche di cessazione ancora non inviate a CRM-B. -- I dati non devono essere aggregati per alcun attributo. --Il record deve essere prodotto anche nel caso il valore rilevato sia "zero". set serveroutput on declare valore varchar2(255); file1 UTL_FILE.file_type; freq varchar2(255):='&1'; cursor cur_valore is Select count(*) FROM MNP_ASP_CRM_CESSAZIONE_OUT WHERE MNP_ASP_CRM_CESSAZIONE_OUT.data_invio is null AND trunc(MNP_ASP_CRM_CESSAZIONE_OUT.data_creazione) < trunc(sysdate) AND trunc(MNP_ASP_CRM_CESSAZIONE_OUT.data_creazione) > '5 ottobre 2003' AND substr(MNP_ASP_CRM_CESSAZIONE_OUT.nome_file,1,19) = 'MNP_CRMBCESS_DONOR_'; 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; fetch cur_valore into valore; UTL_FILE.put_line(file1,'SDNRESP45'||';'||''||';'||valore||';'||freq||';'||'&3'|| ';' ||to_char(sysdate,'yyyymmdd')||';'||to_char(sysdate,'hh24:mi:ss') ||';' ||to_char(sysdate,'yyyymmdd')||';'||to_char(sysdate,'hh24:mi:ss') ||';' ||'0'||';'||valore||';'||''||';'); 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