Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XMLAGG and ORDER BY

454442Sep 16 2005 — edited Sep 16 2005
My select statement with XMLAGG and ORDER BY is working fine in SQL
but when I put it in PL/SQL it throws error
I am using ORACLE version "9.2.0.6.0"

DECLARE ...
BEGIN...
<select_statement>.
END

It throws an error abt XMLAGG function. "wrong number or types of arguments in call to 'XMLAGG'"

THE PL/SQL works fine when I remove the "ORDER BY" from XMLAGG !!

my working sql looks like this

SELECT XMLELEMENT( "Department", XMLATTRIBUTES ( d.dname AS "name" ),
(SELECT XMLAGG(XMLELEMENT ("emp", XMLATTRIBUTES (e.ename AS name),
( SELECT XMLAGG(XMLELEMENT( "dependent",
XMLATTRIBUTES(de.name AS "name")
order by de.name
)
)
FROM dependents de
WHERE de.empno = e.empno ) ))
FROM emp e
WHERE e.deptno = d.deptno) ) AS "dept_list"
FROM dept d ;


Any suggestions?
Sanju

Message was edited by:
user451439
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 14 2005
Added on Sep 16 2005
2 comments
1,138 views