Taimur Islam
Taimur Islam

Reputation: 990

Spool is not working properly in SQL Developer

spool 'D:\\feb_2020.csv';
set embedded on;
set head on;
SET SERVEROUTPUT ON;
SET NEWPAGE 0;
SET PAGESIZE 0;
SET FEEDBACK OFF;
SET ECHO OFF;
set HEADING ON;
set UNDERLINE OFF;
set colsep ',';
set trimspool on;
set linesize 1000;
select id  from table; 
spool off;

I am using this script to save all id info in a csv file from a table. But the problem is no heading of column name is showing in the csv file. I change SET PAGESIZE value, but it insert column name after every mentioned PAGESIZE number. Actually i want heading name only once.

Upvotes: 0

Views: 1665

Answers (1)

Naveen Kumar
Naveen Kumar

Reputation: 2006

To spool using Oracle Sql Developer , reference path of the query is required instead of query.

@test.sql

And test.sql will contain:

select id  from table;

Upvotes: 1

Related Questions