Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> SQLPLUS: creating a text file with column header and tabel rows?
Hello,
I'm going crazy trying to create a simple thing. What I want is a textfile with the column names of a specific table in the first row and the content of the table in the other rows.
The methods I already tried are something like
spool table_content.txt
set colsep |
set headsep |
set wrap on
set pagesize 80000
set trims on
set feedback off
set underline off
select * from mytable;
exit
I can get either a file where the headline (column names) is multible in the file or not at all. I couldn't get just once in the first row. Furthermore has the output linefeeds in between 1 table row. But I want one table row in one file row.
Finally it should be a file which is separated by a delimiter and can be imported into a spreadsheet. It should also be table independent because the queried table could be a parameter in an unix shellscript which is wrapped around the whole thing.
If anyone can help with the set parameters to reach the aim, I would be so glad.
Carsten Received on Tue Aug 09 2005 - 10:02:32 CDT