sqlplus spooling: How to get rid of first, empty line?
SET NEWPAGE NONE
is the correct answer.
SET NEWPAGE 0
will cause a page feed, which is not what the OP wants.
remove blank lines from csv using shell script for oracle
Use the
SET PAGESIZE 0
command to avoid the blank lines. this also suppresses column headings, so you can remove
SET HEADING OFF
The command
SPOOL on
does not make sense because it starts spooling in a file named on.lst
. So remove this command, too.
If you want to display the heading with the column name
you can try the following settings
set HEADING ON
SET FEEDBACK OFF
set WRAP OFF
set COLSEP ,
SET LINESIZE 32767
set NEWPAGE none
set UNDERLINE OFF
set TRIMSPOOL ON
set TRIMOUT ON
set PAGESIZE 50000
´heading on´ is the default so you must not set it. It enables the display of the column names when a select starts. underline off
suppresses the '---' line between column names and data of a select. pages 50000
sets the pagesize to its maximum value (Oracle 11.2). linesize 32767
sets the linesize to its maximum value (Oracle 11.2). newpage none
is necessary to suppress this empty line at the beginning of a page that was the primary concern of your posting.
All this can be found in the SQL*Plus Command Reference
The termout off
parameter suppresses only output created by a scripts that is executed with the @ or @@ command. It dos not suppress out by a command entered in the SQL*plus console. If you use
sqlplus user/passw@connect <<!
...
!
you use the here-document syntax of the shell language which simulates the interactive input. So put your sql commands in a script, e.g. script.sql
, and execute
sqlplus user/passw@connect @script.sql
then termout off
will suppress terminal output.
Instead of
colsep ,
select username,userid
...
which returns something like
user1 , 14
nextuser , 236
myuser , 11
...
you can use leave the COLSEP unchanged and execute
select username||','||userid
...
to get the following output
user1,14
nextuser,236
myuser,11
...
Maybe this is useful
https://dba.stackexchange.com/a/64620/2047
blanks lines in between data rows show up when using SPOOL in SQLPlus
I was able to resolve this by setting: "SET PAGES 0"
Related Topics
How to Convert Milliseconds to Time(Hh:Mm:Ss) in Oracle
How to Merge Multiple Rows into Single in Oracle
Sql: Update Column With Increment Numbers Based on 2 Columns
Convert Utc Milliseconds to Datetime in SQL Server
Getting Student Name With Highest Total Mark in SQL
Mysql - Left Join Takes Too Long, How to Optimize Query
Exclude a Column Using Select * [Except Columna] from Tablea
How to Sum Up Time Field in SQL Server
Postgres Query to Check a String Is a Number
Sql Query to Select Million Records Quickly
Adding $ Dollar Sign on My Total Cost in SQL Server
Select Count of Total Products as Well as Out of Stock Products from Table
Unioning Two Tables With Different Number of Columns
Sql Join: Selecting the Last Records in a One-To-Many Relationship
How to Get the Numeric Part from a String Using T-Sql
Postgresql Query to Return Results as a Comma Separated List