XML Database (MOSC)

MOSC Banner

How to remove duplicates when SQL output is in XML format?

edited Aug 7, 2018 12:33PM in XML Database (MOSC) 7 commentsAnswered ✓

Hello,

I run this script to get the XML output from my SQL query:

select dbms_xmlgen.getxml('select dept.deptno dn, emp.job jb, emp.ename en from scott.emp emp, scott.dept dept where dept.deptno = emp.deptno and dept.deptno = 20 order by 1, 2, 3') xml from dual;

Here is the output:

As you can see, deptno and job have been repeated.  How can I achieve result in which deptno and job just appear once like below but in XML format:

Please help.

Thanks,

Ning

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center