Export Oracle Table Data by DBMS_XMLGEN -> How to Import? -
i can easy export table data using dbms_xmlgen. there package reimport xml?
create table foo( id number ,text varchar2(30) ) / insert foo values (1,'hello'); insert foo values (2,'world'); declare l_foo_xml clob; begin l_foo_xml := dbms_xmlgen.getxml('select * foo'); delete foo; --- ???? insert xml foo ??? end; /
thanks christian
have looked @ dbms_xmlsave?
the oracle documentation doesn't give examples of it's use, quick google show you.
here based on example. (which inspired information here)
create table foo( id number ,text varchar2(30) ) create or replace procedure p(p_xml in clob, p_table_name in varchar2) l_context dbms_xmlsave.ctxtype; l_rows number; begin l_context := dbms_xmlsave.newcontext(p_table_name); l_rows := dbms_xmlsave.insertxml(l_context, p_xml); dbms_xmlsave.closecontext(l_context); end; /
call procedure p sample xml
declare l_xml clob; begin l_xml := '<rowset> <row num="1"> <id>123</id> <text>some text</text> </row> </rowset>'; p(p_xml => l_xml, p_table_name => 'foo'); end; /
query table
select * foo
Comments
Post a Comment