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.
|