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.
|
|
|
|
Guarantee your Success!
Oracle is the
world's most complex, robust and flexible database, considered
impossible to master without a mentor.
That's why all BC
Oracle trainers are working professionals, experts in Oracle who
share their tips and secrets. |
|
| |
|
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.
Copyright © 1996 - 2012
All rights reserved.
Oracle ©
is the registered trademark of Oracle Corporation.
|
|