Main Topics
Browse All TopicsI get an error when i use XMLELEMENT with a large XML label (more than 30 characters).
Does XML have this limitation on labels? Is there a way around this using XMLELEMENT instead of using PL/SQL to generate the tags by code.
SELECT XMLELEMENT("EmployeeListth
XMLAGG(XMLELEMENT("Name", e.job_id || ' ' || e.last_name))) AS "Result"
FROM employees e
WHERE employee_id > 200;
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I agree with shru, it shouldn't be a problem.
The following works for me in 10.2.0.3:
-----------------
sele
Please provide the error message you are receiving and exact database version.
I also set up a quick test using your SQL on 10.2.0.3 and it works.
slightwv's example seems pretty clear cut.
I don't see how either of the links above answer the question though. neither mention name lengths. if they do, please indicate where, because I missed it.
sam15,
If you are having errors please show them and list exactly what version you are perhaps it's simply a matter of patching.
I don't have a 9.2.0.2, the remaining 9i's I work with are all 9.2.0.8
I don't recommend the REPLACE because it "should" be an unnecessary extra step.
If however, you can't get patched, the REPLACE should work.
Note, you might not be able to convert it back to XMLTYPE after doing so if you already have smaller limitations
If you don't want to use replace.
This will probably hit the same 'bug' but there are a few ways around creating the same XML in Oracle.
See if this hits the bug:
SELECT XMLFOREST(
XMLAGG(XMLELEMENT("Name", e.job_id || ' ' || e.last_name)) as "EmployeeListthatneedsproc
FROM emp_test e
WHERE employee_id > 200;
I remember early 9.2 being VERY buggy when it comes to XML. I'll try to think of another possible work-around but I'm thinking you might be back to using replace as long as you don't have to go back to XMLTYPE in Oracle as sdstuber suggested.
FYI: Things really didn't get stable with XML until 9.2.0.4.
We use XML a lot and for what it's worth: I'm now on 11.1.0.7 and would NEVER think of going back. XML gets better and MUCH faster with every release and patch. Can't wait for 11.2.
Business Accounts
Answer for Membership
by: shru_0409Posted on 2009-11-02 at 04:47:25ID: 25718851
http://www.adp-gmbh.ch/ora /sql/xmlel ement.html
check this link may help u