I have a script like this:
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET TERMOUT OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
SET WRAP OFF
SET LINESIZE 32000
SET LONG 32000
SET LONGCHUNKSIZE 32000
SET SERVEROUT ON
SPOOL C:\Export.txt
SELECT XMLELEMENT("element1",xmlelement("element2",xmlattributes(.....)))
FROM --TABLENAME--
WHERE --CONDITIONS--
The output should be a file containing a list of rows with the complex xml inside, but when the length of the XML generated is longer than 2000, SQLPlus trims to 2000 and go to the next line.
There is a way to force SQLPlus to write all the data in the same line?
Are you on Windows? I was having this same problem and neither of the other two answers helped me (directly, I had to do one more thing). Following the advice of this article on setting up SQL*Plus for Windows the author notes:
I set mine as
SET LONG 32000
(my longest line was a little over 2000 characters) and that solved the problem for me.