Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Parsing xml with PL/SQL
use a pl/sql table of records of type node
use instr and substr
pass 'emp', 'empno', 'ename' to the procedure
although CLOBs might change some of that a little.
"Hosie" <kowens_at_datascantech.com> wrote in message
news:3b3aecf9.0303060631.43084344_at_posting.google.com...
> I am a newbie using XML with PL/SQL. I would like to pass XML as a
> CLOB to a stored procedure, parse the nodes in a loop and insert or
> update records. Something like this:
>
> The xml:
> <emps>
> <emp>
> <empno>7369</empno>
> <ename>SMITH</ename>
> </emp>
> <emp>
> <empno>7499</empno>
> <ename>ALLEN</ename>
> </emp>
> </emps>
>
> In the stored procedure:
> begin
> load xmlClob into parser p
> nodelist = p.someMethod( '/emps/emp' )
> for each node in nodelist
> insert into emp( empno, ename) values ( node.empno, node.ename
> );
> end loop
> cleanup
> end
>
> Any assistance you could provide would be greatly appreciated.
>
> TIA
Received on Thu Mar 06 2003 - 15:13:45 CST