Pretty-Print XML in SQL*Plus Wraps After 80 Characters. How to Prevent this? (Doc ID 1372684.1)

Last updated on NOVEMBER 04, 2011

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.2.0.3 - Release: 10.2 to 11.2
Information in this document applies to any platform.

Goal

When attempting to pretty-print XML using xmlserialize() from SQL*Plus, the output always wraps after 80 characters.

Please see the following example:

SQL> set long 200000
SQL> set linesize 132

SQL> SELECT xmlserialize(Document XMLELEMENT (TEST,
  2  xmlattributes ('attribute1' AS a1,
  3  'attribute2' AS a2,
  4  'attribute3' AS a3,
  5  'attribute4' AS a4,
  6  'attribute5' AS a5
  7  ),
  8  XMLELEMENT (test2, 'test2 value')
  9  ) indent )
 10  FROM DUAL;

XMLSERIALIZE(DOCUMENTXMLELEMENT(TEST,XMLATTRIBUTES('ATTRIBUTE1'ASA1,'ATTRIBUTE2'
--------------------------------------------------------------------------------
<TEST A1="attribute1" A2="attribute2" A3="attribute3" A4="attribute4" A5="attrib
ute5">  <----
 <TEST2>test2 value</TEST2>
</TEST>

What formatting option needs to be specified in SQL*Plus so that the output does not wrap after 80 characters?

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms