I have tried the query using XMLAgg() , but my output does not contain the closing tags for Department </DEPARTMENT> it seems to be cut off for some reason. <Employee>PRESID got cut off also, it should be PRESIDENT and MANAG should have been MANAGER.
I am using Oracle 9i r2, windows version on sqlplus worksheet.
Why is it skipping the closing tag for Department and How can I fix this?
Thanks,
olmos
--------------
Query :
---------------
SELECT XMLELEMENT("Department", XMLAttributes(deptno AS deptno),
XMLAGG(XMLELEMENT("Employee", e.job||' '||e.ename)))
AS "Dept_list"
FROM emp e
GROUP BY e.deptno;
--------------------------
The output I get is :
--------------------------
Dept_list
<Department DEPTNO="10">
<Employee>MANAGER CLARK</Employee>
<Employee>PRESID
<Department DEPTNO="20">
<Employee>CLERK SMITH</Employee>
<Employee>ANALYST
<Department DEPTNO="30">
<Employee>SALESMAN ALLEN</Employee>
<Employee>MANAG
I am using Oracle 9i r2, windows version on sqlplus worksheet.
Why is it skipping the closing tag for Department and How can I fix this?
Thanks,
olmos
--------------
Query :
---------------
SELECT XMLELEMENT("Department", XMLAttributes(deptno AS deptno),
XMLAGG(XMLELEMENT("Employee", e.job||' '||e.ename)))
AS "Dept_list"
FROM emp e
GROUP BY e.deptno;
--------------------------
The output I get is :
--------------------------
Dept_list
<Department DEPTNO="10">
<Employee>MANAGER CLARK</Employee>
<Employee>PRESID
<Department DEPTNO="20">
<Employee>CLERK SMITH</Employee>
<Employee>ANALYST
<Department DEPTNO="30">
<Employee>SALESMAN ALLEN</Employee>
<Employee>MANAG