PROCEDURE excel_p IS cursor c1 is select alt_loc loc, alt_doc_no docno, alt_doc_typ doctyp, alt_inv_no invno, alt_inv_dt invdt, alt_authid postno, alt_amt Amount from acc_loc1_tab where alt_authdt between :BLOCK15.FROMDATE and :BLOCK15.TODATE and alt_loc = :BLOCK15.LOCATION ; cursor c2 is select alt_cd code1, sum(alt_amt) amount1 from acc_loc1_tab where alt_authdt between :BLOCK15.FROMDATE and :BLOCK15.TODATE and alt_loc = :BLOCK15.LOCATION ; GROUP BY ALT_CD; FILE_PTR CLIENT_TEXT_IO.FILE_TYPE;-------capture only text data V_TOTAL NUMBER := 0; v_code acc_loc1_tab.alt_cd%type; v_code1 acc_loc1_tab.alt_cd%type; begin message('3'); FILE_PTR:= CLIENT_TEXT_IO.FOPEN(:filename,'w');---w window , chr(44)-Delimeter comma separated CLIENT_TEXT_IO.NEW_LINE(FILE_PTR);------space client_text_io.put_line(file_ptr,'Report From Date '||:BLOCK15.fromdate||' TO '||:BLOCK15.todate); client_text_io.new_line(file_ptr); client_text_io.put_line(file_ptr,'Location code is '||:BLOCK15.location); client_text_io.new_line(file_ptr); client_text_io.put_line(file_ptr,'LOCATION'||CHR(44)||'DOCUMENT NO'||CHR(44)||'DOCUMENT TYPE'||CHR(44)||'INVOICE NO'||CHR(44)||'Invoice Date'||CHR(44)||'POST NUMBER'||CHR(44)||'AMOUNT'); client_text_io.new_line(file_ptr); message('4'); FOR I IN c1 LOOP EXIT WHEN c1%NOTFOUND; --synchronize; client_text_io.put_line(FILE_PTR,I.LOC||CHR(44)||I.docno||chr(44)||I.doctyp||chr(44)||NVL(I.invno,'0')||chr(44)||i.invdt||chr(44)||I.postno||CHR(44)||I.AMOUNT); synchronize; END LOOP ; IF c1%ISOPEN THEN CLOSE c1; END IF; -- client_text_io.new_line(file_ptr); -- client_text_io.put_line(file_ptr,'code is '||CODE1); -- message('5'); for I1 in c2 loop exit when c2%notfound; client_text_io.put_line(file_ptr,i1.code||chr(44)||I1.AMOUNT1); END LOOP; IF C2%ISOPEN THEN CLOSE C2; END IF; synchronize; CLIENT_TEXT_IO.FCLOSE(FILE_PTR); message(' The File'||:FILENAME||'has been generated successfully'); END;