Oracle SQL*Loader 获取 CDATA 值
有人知道该怎么做吗? 我知道有一种更好的方法可以在不使用 SQL*Loader 的情况下将 XML 数据加载到 Oracle,但我只是好奇如何使用它来完成此操作。 我已经有一个可以将 XML 数据加载到数据库的代码,但是,如果 XML 文件具有包含 CDATA 的值,它就不会运行...
下面是控制文件代码,如果值不是 CDATA,则该代码可以工作。 ..
LOAD DATA
INFILE FRATS.xml "str '</ROW>'"
APPEND
INTO TABLE "FRATERNITIES"
(
DUMMY FILLER TERMINATED BY "<ROW>",
THE_CODE SEQUENCE (MAX, 1),
DUMMY2 FILLER TERMINATED BY "</COLUMN>",
STORE_NN_KJ ENCLOSED BY '<COLUMN NAME="THE_NAME">' AND '</COLUMN>',
STAFF_COUNT ENCLOSED BY '<COLUMN NAME="THE_COUNT">' AND '</COLUMN>'
)
这是 XML 文件:
<结果>
<行>
<列名称=“THE_CODE”>777
<列名称=“THE_COUNT”>24
这是带有 CDATA 值的 XML 文件。 我的控制文件不会随之运行...:
<结果>
<行>
Anybody knows how to do this? I know there's a better way of loading XML data to Oracle without using SQL*Loader, but I'm just curious on how this is done using it. I have already a code that can load XML data to the DB, however, it wont run if the XML file has values that contain a CDATA...
Below is the control file code which works if the values are not CDATA...
LOAD DATA
INFILE FRATS.xml "str '</ROW>'"
APPEND
INTO TABLE "FRATERNITIES"
(
DUMMY FILLER TERMINATED BY "<ROW>",
THE_CODE SEQUENCE (MAX, 1),
DUMMY2 FILLER TERMINATED BY "</COLUMN>",
STORE_NN_KJ ENCLOSED BY '<COLUMN NAME="THE_NAME">' AND '</COLUMN>',
STAFF_COUNT ENCLOSED BY '<COLUMN NAME="THE_COUNT">' AND '</COLUMN>'
)
Here's the XML file:<?xml version='1.0' encoding='MS932' ?>
<RESULTS>
<ROW>
<COLUMN NAME="THE_CODE">777</COLUMN>
<COLUMN NAME="THE_NAME">CharlieOscarDelta</COLUMN>
<COLUMN NAME="THE_COUNT">24</COLUMN>
</ROW>
</RESULTS>
Here's the XML file with CDATA values. My control file will not run with it...:<?xml version='1.0' encoding='MS932' ?>
<RESULTS>
<ROW>
<COLUMN NAME="THE_CODE"><![CDATA[777]]></COLUMN>
<COLUMN NAME="THE_NAME"><![CDATA[CharlieOscarDelta]]></COLUMN>
<COLUMN NAME="THE_COUNT"><![CDATA[24]]></COLUMN>
</ROW>
</RESULTS>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你试过
编辑
看起来我忘记了)..试试这个..
have you tried
EDIT
Looks like I forgot a ).. Try this..