I have a query called in a CSH script which is a simple select. I would like to write the result of the select statement in a a flat file but when i set the "SET HEADING OFF" and "SET FEEDBACK OFF", i get a blank line written to the flat file. When i executed the query in SQLPLUS and the settings off, i really had some spaces.

SQL> select employee_id||','||first_name||','||last_name row_list
> from employees;


I got a blank in the first result where the column name used to reside. And in between the result set, i also get some blank lines because of the default page size. No matter how i set the page size, i still don't know how will i know how long the data/result will be, meaning at one point there will still be a blank space that will be written in the flat file. Is this something that can be set to SQLPLUS or in the CSH script??

Recommended Answers

All 2 Replies

Are you using the SPOOL command to generate the flat file ?

I am not using the SPOOL. This is how i take results from my select query in my CSH script:

$ORACLE_HOME/bin/sqlplus -s hr/hr@xe @write_to_file.sql > result.dat

Where write_to_file.sql contains:

set heading off
set feedback off

select employee_id||','||first_name||','||last_name row_list
from employees;


It is because when i used the SPOOL, it is also printing the SQL commands I executed in SQLPLUS. I need the flat file in some other programs as it is.

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.