将XML格式的数据插入Oracle数据库 [英] Inserting Data in XML into Oracle database

查看:106
本文介绍了将XML格式的数据插入Oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是从一个数据库(非oracle db)获取数据并将该数据插入另一个数据库(oracle).

My task is to get data from One database (non oracle db) and insert that data into another database(oracle).

我能够以XML的形式从源数据库中获取数据.现在,我必须将此XML作为输入传递到oracle数据库,以便将XML内部的所有数据插入到oracle数据库表中.

I am able to get the data from the source database in the form of XML. Now I have to pass this XML as input to the oracle database so that all the data inside the XML is inserted into the oracle database table.

请问有人可以指导我,因为这样做的代码是什么.我已经习惯了SQL Server2005.

Can some one please guide me as what is the code for doing the same. I am quite used to SQL Server 2005.

如果有人可以指导如何将XMl中的数据插入表中,那将有很大帮助.

If some one can guide with how insert data in XMl into a table, it would be of great help.

推荐答案

这是我能看到的通用的xml结构.

This is as generic as I can make it without seeing the xml structure..

create or replace procedure put_stuff_into_table(source_xml_doc xmltype) AS

BEGIN

insert into table (a, b)
select *
from xmltable('<TOP_LEVEL_ELEMENT>'
              passing source_xml_doc
              columns a number        path 'ELEMENT_TAG_A',
                      b varchar2(100) path 'ELEMENT_TAG_B'
             );
END;
/ 

这篇关于将XML格式的数据插入Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆