views:

159

answers:

1

I am running a query that returns XML data and spools to a file. I'm having a problem where the output of the query is being truncated. Here's what it looks like:

XMLDATA                                          
----------------------------------------         
<?xml version="1.0" standalone="yes"?>           
<msgs>                                           
  <msg>                                          
    <PNUM>ABC12345                       

What I am expection was something like this:

XMLDATA                                          
----------------------------------------         
<?xml version="1.0" standalone="yes"?>           
<msgs>                                           
  <msg>                                          
    <PNUM>ABC1234567</PNUM>
    <MSG_ID>1234</MSG_ID>
    <NAME>Test message</NAME>
    <TEXT>This is the main content of the message</TEXT>
  </msg>
  <!-- about 60 other msg elements -->
</msgs>

The select statement is simple enough:

select xmlroot(xmlelement("msgs",xmlagg(xmlelement("msg",xmlforest(PNUM , MSG_ID , NAME, TEXT)))), VERSION '1.0', STANDALONE YES) xmldata
from ...

I am guessing there's some sqlplus formatting trick here, I just don't know which one (or even what it's called).

(Oracle version is 10g)

+1  A: 

This might help:

The default width of datatype columns is the width of the column in the database. The column width of a LONG, CLOB, NCLOB or XMLType defaults to the value of SET LONGCHUNKSIZE or SET LONG, whichever is the smaller, so I set BOTH LONG and LONGCHUNKSIZE to 32K and it worked beautifully.

Marcus
Thanks, that worked! :) For me, setting `SET LONG 5000000` seems to work for all of my data. Setting `LONGCHUNKSIZE` doesn't seem to do much.
FrustratedWithFormsDesigner