简体   繁体   English

将 XML 文件加载到 oracle 数据库中

[英]Load XML file into oracle database

I have XML file content as below我有 XML 文件内容如下

<Student id="101">
<Name>ABC</Name>
<Class>6</Class>
</student>

I want to load that content into oracle data base including tags also.Help me to clear off this.我想将该内容加载到 oracle 数据库中,还包括标签。帮我清除这个。

I think I would use CLOB for the data type and QUOTATION for DML operations, thereby I'd keep the formatting and structure of the xml document without having to escape all reserved characters:我想我会使用 CLOB 作为数据类型,使用 QUOTATION 作为 DML 操作,因此我会保留 xml 文档的格式和结构,而不必转义所有保留字符:

Example例子

SQL> create table my_test ( c1 clob );

Table created.

SQL> insert into my_test values
    (
     q'[<Student id="101">
        <Name>ABC</Name>
        <Class>6</Class>
       </student>]'
    );
 
 1 row created

SQL> commit;

SQL> select * from my_test ;

C1
--------------------------------------------------------------------------------
<Student id="101">
<Name>ABC</Name>
<Class>6</Class>
</student>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM