Generate XML from PL/SQL proc [message #598629] |
Wed, 16 October 2013 06:34 |
|
plsqlish
Messages: 8 Registered: December 2011
|
Junior Member |
|
|
HI,
I have a requirement to generate the XML file from a pl/sql procedure.
The methods which I have searched are either generating the xml from a single query or they are explicitely adding the nodes and elements.
I need the method where I can dynamically append child nodes to the file.
Thanks,
|
|
|
|
|
|
Re: Generate XML from PL/SQL proc [message #598687 is a reply to message #598685] |
Wed, 16 October 2013 15:14 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
thelearner wrote on Thu, 17 October 2013 01:40In my database I don't have dbms_xmlquery.getxml package.
It was introduced in Oracle 8i as a Java Servlet. In Oracle 9i its functionality has been extended, with a subset of it's functionality being incorporated into the database kernel giving improved performance along with Java and PL/SQL APIs.
How did you conclude it is not there? What is your DB version?
|
|
|
|
|
|
|
Re: Generate XML from PL/SQL proc [message #598759 is a reply to message #598710] |
Thu, 17 October 2013 08:59 |
|
thelearner
Messages: 133 Registered: April 2013 Location: INDIA
|
Senior Member |
|
|
Thank you Solomon Yakobson.... I got the complete output using SET LONG and SET LONGCHUNKSIZE
SQL> select dbms_xmlgen.getxml('select * from emp where rownum <= 3') from dual;
DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREROWNUM<=3')
--------------------------------------------------------------------------------
<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREROWNUM<=3')
--------------------------------------------------------------------------------
<ROW>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREROWNUM<=3')
--------------------------------------------------------------------------------
<EMPNO>7521</EMPNO>
<ENAME>WARD</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>22-FEB-81</HIREDATE>
<SAL>1250</SAL>
<COMM>500</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
</ROWSET>
SQL>
Thanks
The Learner.
[Updated on: Thu, 17 October 2013 09:00] Report message to a moderator
|
|
|
|