Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

how to eliminate blank line in sqlplus output

vxwo0owxvDec 8 2011 — edited Dec 8 2011
#!/bin/ksh

#Hi I am doing a data extract using sqlplus but the output has a blankline in it.
#How I ask sqlplus to not putting that blankline. Thanks so much for the kind help

mydate=`date '+%m%d%Y'`

file_ext=".txt"
file_hdr="testlinespace"
OUTFILE=`echo $file_hdr$mydate$file_ext`
echo $OUTFILE

mytime_start=`date '+%Y%m%d_%H%M%S'`
echo $mytime_start

sqlplus -silent /nolog << EOF
CONNECT scott/tiger@orc1.world

set echo off
set colsep ' '
set pagesize 0
set trimspool on
set headsep off
set linesize 100
set pagesize 50
set heading off
set feedback off
set timing off
set time off
set termout off
set headsep off

spool $OUTFILE


WITH a1 as
(
SELECT object_id,object_name from all_objects
)
SELECT * FROM a1 where rownum < 1001;



spool off

select to_char(sysdate,'YYYYMMDD_HH24MISS') from dual;

exit
$

Comments

21205
...why the commit?...
set serveroutput on
before you start the spool
576633
create or replace procedure hmm as
begin
dbms_output.put_line('Test1');
dbms_output.put_line('Test2');
dbms_output.put_line('Test3');
dbms_output.put_line('Test4');
dbms_output.put_line('Test5');
end;

spool C:\Temp\test.spl;
exec hmm;
spool off;
File content is:

Test1
Test2
Test3
Test4
Test5
PL/SQL procedure successfully completed.
21205
Answer
...but you probably have your serveroutput turned on? Maybe in your login script?
show serveroutput
Marked as Answer by 485654 · Sep 27 2020
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 5 2012
Added on Dec 8 2011
1 comment
17,706 views