Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Create excelfile from pl/sql
Roland,
IFf you separate each column with the tab character (chr(9)), excel will open the file without requiring you to go through the import steps.
You should be aware that the file is still not a true Excel file, and that when you save the file, you will then be asked if you want to save it as a true spreadsheet.
The pl/sql block below would produce a simple excel type file.
DECLARE
CURSOR c1 IS
SELECT 1 || CHR(9) || 2 || CHR(9) || 3 out_rec
FROM dual;
file_handle utl_file.file_type;
BEGIN
file_handle:=UTL_FILE.FOPEN('directory','Test.xls', 'W');
FOR c1_rec IN c1 LOOP
UTL_FILE.PUT_LINE(file_handle,c1_rec.out_rec);
END LOOP;
utl_file.fclose(file_handle);
END;
/
Hope this helps
Tom Mercadante
Oracle Certified Professional
-----Original Message-----
Sent: Monday, September 24, 2001 10:00 AM
To: Multiple recipients of list ORACLE-L
Hallo,
How can I create a excelfile with the UTL_FILE packet, I wantthe file to be able to opened directly in excel, without goingthrough the import step when I open the file.
Give me an example, please.
Roland
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: Roland.Skoldblom_at_ica.se
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Mon Sep 24 2001 - 10:08:44 CDT