- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsI'm passing an xml string from front-end. I'm looking for an example to read the xml string, fetch data from it in form of a table and insert the data into my physical table.
Something similar to sp_XmlPrepareDocument functionality in Sql Server.
I've seen examples over the internet, but they show to read an xml file.
Can someone plz provide a sample wherein I can read an xml string.
Thanks in advance
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.
Business Accounts
Answer for Membership
by: schwertnerPosted on 2009-04-28 at 01:38:11ID: 24248673
THE REAL RESULT:
bleName); -- get the context handle Ctx,xmlDoc ); -- this inserts the document ar(rows) || ' rows inserted'); insCtx); -- this closes the handle
E>Perry Smith OB><EMPSAL>80 0</EMPSAL></R OW><ROW num="1"><EMPID>20</EMPID><EMPNAM E>J ipal Support Consultant</EMPJOB><EMPSAL>900 </EMPSAL></RO W><ROW num uis Bald</EMPNAME><EMPJOB>Technica l Specialist</EMPJOB><EMPSAL>400 < E>Anthony Flowers</EMPNAME><EMPJOB>Techn ical Team SAL></ROW><ROW num="1"><EMPID>50</EMPID><EMPNAM E>George Monk</EMPNAM </EMPSAL></RO W></ROWSET>', 'empleados ');
---- -------------------------- ----
---- -------------------------- ----
---------- ---------- ---------- -
d)) FROM empleados;
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jan 13 14:56:19 2004
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect xml/xml@test
SQL> CREATE TABLE empleados (empid NUMBER PRIMARY KEY,
2 empname VARCHAR2(30),
3 empjob VARCHAR2(30),
4 empsal NUMBER);
Table created.
SQL> create or replace procedure InsertXML(xmlDoc IN VARCHAR2, tableName IN VARCHAR2) is
2 insCtx DBMS_XMLSave.ctxType;
3 rows number;
4 begin
5 insCtx := DBMS_XMLSave.newContext(ta
6 rows := DBMS_XMLSave.insertXML(ins
7 dbms_output.put_line(to_ch
8 DBMS_XMLSave.closeContext(
9 end;
10 /
Procedure created.
SQL> exec InsertXML('<?xml version="1.0"?><ROWSET><ROW num="1"><EMPID>10</EMPID><EMPNAM
</EMPNAME><EMPJOB>Manager</EMPJ
ohn Calvach</EMPNAME><EMPJOB>Princ
="1"><EMPID>30</EMPID><EMPNAME>Lo
/EMPSAL></ROW><ROW num="1"><EMPID>40</EMPID><EMPNAM
Leader</EMPJOB><EMPSAL>500</EMP
E><EMPJOB>Support Consultant</EMPJOB><EMPSAL>200
PL/SQL procedure successfully completed.
SQL> select * from empleados;
EMPID EMPNAME EMPJOB
---------- --------------------------
EMPSAL
----------
10 Perry Smith Manager
800
20 John Calvach Principal Support Consultant
900
30 Louis Bald Technical Specialist
400
EMPID EMPNAME EMPJOB
---------- --------------------------
EMPSAL
----------
40 Anthony Flowers Technical Team Leader
500
50 George Monk Support Consultant
200
SQL>
SQL> select SYS_XMLGEN(empid) FROM empleados;
SYS_XMLGEN(EMPID)
--------------------------
<?xml version="1.0"?>
<EMPID>10</EMPID>
<?xml version="1.0"?>
<EMPID>20</EMPID>
<?xml version="1.0"?>
<EMPID>30</EMPID>
<?xml version="1.0"?>
<EMPID>40</EMPID>
SYS_XMLGEN(EMPID)
<?xml version="1.0"?>
<EMPID>50</EMPID>
SQL> select SYS_XMLAGG(SYS_XMLGEN(empi
<?xml version="1.0"?>
<ROWSET>
<EMPID>10</EMPID>
<EMPID>20</EMPID>
<EMPID>30</EM