Re: sqlplus csv column headings
Date: Thu, 17 Jan 2008 06:45:59 -0800 (PST)
On Jan 17, 9:35 am, burrell.j..._at_yahoo.com wrote:
> I am
> trying to generate csv file from the output of a sqlplus.
> 9i on unix.
> Dome quite well so far.
> spool wed.csv
> set colsep |
> set heading off
> set feedback off
> set linesize 4000
> set trimspool on
> set pagesize 0
> That colsep command is really useful BTW.
> Anyhow know how can I get the column heads just once?
To get the column headings you could select them as constants from dual or select them from dba_tab_columns and union this to your query to get the data.
The problem with using colsep instead of concatenating the columns is that you get a fixed format file which takes more space than concatenated column lists. With large tables the difference in approaches can result in significantly different OS file size requirements.
How do I export a database table to a flat file ?
HTH -- Mark D Powell -- Received on Thu Jan 17 2008 - 08:45:59 CST