Home » SQL & PL/SQL » SQL & PL/SQL » Print command blank line (merged) (Oracle PL-SQL)
Print command blank line (merged) [message #430104] Sun, 08 November 2009 06:29 Go to next message
bigb12345
Messages: 2
Registered: November 2009
Junior Member
Hello,
I am trying to spool some info using variable & print command. but print command is introducing extra blank line. how to handle this.

e.g.

set verify off
set echo off
set pause off
set heading off
set feedback off
set trimout on
set trimspool on
set linesize 10000
set newpage NONE
set pagesize 0
set space 0
set arraysize 2000
set termout off

spool c:\test.txt

variable v_line_0 VARCHAR2(250);
exec :v_line_0 := '<?xml version="1.0" encoding="ISO-8859-1" ?>';
--
variable v_line_1 VARCHAR2(50);
exec :v_line_1 := 'Test-1';
--
variable v_line_2 VARCHAR2(50);
exec :v_line_2 := 'Test-2';
--
print :v_line_0;
print :v_line_1;
print :v_line_2;

select 'x' from dual;
select 'x' from dual;

spool off;

---->Output

<?xml version="1.0" encoding="ISO-8859-1" ?>

Test-1

Test-2

x
x
----->Should be

<?xml version="1.0" encoding="ISO-8859-1" ?>
Test-1
Test-2
x
x

Thanks
Santosh
Re: Print command blank line (merged) [message #430106 is a reply to message #430104] Sun, 08 November 2009 06:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
select :v_line_0 from dual 
union all
select :v_line_1 from dual 
union all
select :v_line_2 from dual 
/


Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel

Re: Print command blank line (merged) [message #430109 is a reply to message #430106] Sun, 08 November 2009 07:26 Go to previous messageGo to next message
bigb12345
Messages: 2
Registered: November 2009
Junior Member
Thanks Michel,

this is one of solution but I do have arround 20 variables.

is there any way by which we can remove this blank line from print command. any set option in sqlplus.

Regards
Santosh
Re: Print command blank line (merged) [message #430113 is a reply to message #430109] Sun, 08 November 2009 08:58 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
this is one of solution but I do have arround 20 variables.

And it is a big work to write
select :myvar from dual
instead of
print myvar
doesn't it?

Quote:
is there any way by which we can remove this blank line from print command. any set option in sqlplus.

No.

Regards
Michel
Previous Topic: updating values of a column
Next Topic: Except Friday Query
Goto Forum:
  


Current Time: Sat Dec 03 19:55:59 CST 2016

Total time taken to generate the page: 0.05064 seconds