Why do you want to produce file with Comma Separated Values when you can produce an XLSX file directly?
- run sql
- on the results table at the bottom, "right click -> export..."
You can do this
SET colsep ,
SET pagesize 20
SET trimspool ON
SET linesize 200
set trimspool on
set headsep off
select owner, table_name, tablespace_name
where tablespace_name in ('SALESTBS','MARKETINGTBS');
You can then go to your file location: C:\Users\yourname\Documents\filename.csv
Alternatively, you can use /*csv*/ hint: For example
select /*csv*/ owner, table_name, tablespace_name from all_tables where tablespace_name in ('SALESTBS','MARKETINGTBS');
Also, see this thread. SPOOLing in sql developer does not take into consideration SET ECHO OFF
please help, I want to spo a query output to my c: drive in comma delimited format and also keeping the column headers so that when I export it to excel I can have the header on top.
Thanks for your help
Sql Dev has been able to do that for some time now.
select /*csv*/ * from emp
Then right-click and save the result grid.
See this article for more details.
Thank you guys, you all have been marvelous, unfortunately I the system can only pick one correct answer but I think you were all correct in this case.
I am very grateful