create an sql file like this (do_csv.sql):
set heading off
set space 0
set pages 0
set linesize 0
set echo off
set feedback off
spool my_csv.csv
select '"COL1","COL2"' from dual;
select '"'||col1||'"'||','||
'"'||col2||'"'
from csv_tab;
spool off
exit;
Then, just run this file via sqlplus -s id/pass@db_name @do_csv
Works like a charm...
-----Original Message-----
From: Mujeeb Chowdhry [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 17, 2002 7:38 PM
To: Multiple recipients of list ORACLE-L
Subject: How to extract data from existing table to csv file.
Hi All,
Could anyone tell me how to get data from existing table as a csv file using sql*plus. Appreciate any suggestions.
Thanks
Mujeeb Chowdhry
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Mujeeb Chowdhry
INET: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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).