Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

dbms_xmlgen.getxml Output Spans Multiple Lines

Expert Oracle Database Tips by Burleson Consulting

March 8, 2015

 

Question:  I have this Oracle XML and I get an external XML parsing error because the tag spans multiple lines:

set pages 0
set lines 150
set long 9999999
set head off select dbms_xmlgen.getxml
('select * from (select no,subject where mykey=1)') xml from dual ;
quit

<?xml version="1.0"?>
<ROWSET>
<ROW>
<NO>11822191</NO>
<SUBJECT>123456789 123456789 123456789 123456789 123456789 123456789 12</SUBJ
ECT>
</ROW>
</ROWSET>

As you see, the <SUBJECT> XML tag is spanning in two lines, and so the output is invalid for external xml parser.

What is the line continuation character for Oracle XML when using dbms_xmlgen?

Answer:  There is no "continuation" character in native XML!!!  

Normally, if you write an XML on several lines, leave whitespace, like this:

<SUBJECT>
123456789 123456789 123456789 123456789 123456789 123456789 12
</SUBJECT>

However, you have dbms_xmlgen output executed from SQL*Plus, and the line break is created by SQL*Plus, not dbms_xmlgen.  

Rarely, there are cases of the error:  

ORA-01706:  User function result value was too large  

But in your case, the SQL*Plus output is truncated to 77 characters.  

Start by spooling the SQL*Plus output to a flat file and see if it spans there:

#!/bin/ksh
sqlplus -S system/manager << !
set pages  999
set lines  999
set long  9999
set head off spool /tmp/myfile.txt
select dbms_xmlgen.getxml ('select * from (select no, subject where mykey=1)') xml from dual ;
spool off
exit
!
cat /tmp myfile.txt

It is also possible that your SQL*Plus output line length is not long enough.  Try going to 110 line using the following command:

set lines 110

If 110 is not long enough, you can try larger numbers.

If it is still truncating at 77 characters at this point, try the following with 100 character SQL output:

spool /tmp/myfile.txt
select '123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 123456789 123456789'
from dual;
spool off

If this works for you with the XML package, it would appear that you have hit a bug with dbms_xmlgen.getxml.

You can check MOSC for more information.

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2016

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.


 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster