从网上找了很多版本,没有找到自己想要的,然后简单总结了下,看的比较明了一些
xml:
<root>
<abc>张</abc>
<def>王</def>
<jhk id="83" type="01" start="09" end="10" reason="11" />
</root>
oracle:
xml := '';
id_value := '';type_value := '';start_value := '';end_value := '';
abc_value := '';def_value := '';
select xml_value into xml_ from table where xml_value = 'xml';
--获取节点属性的信息
BEGIN
SELECT extract(VALUE(t), '//@id').getStringVal(),
extract(VALUE(t), '//@type').getStringVal(),
extract(VALUE(t), '//@start').getStringVal(),
extract(VALUE(t), '//@end').getStringVal()
INTO id_value,
type_value,
start_value,
end_value
FROM TABLE(xmlsequence(extract(xmltype(xml_), '/root/jhk'))) t;
EXCEPTION
WHEN OTHERS THEN
s_result

这篇博客主要介绍了在Oracle数据库中如何使用存储过程解析XML文件,作者在尝试多种方法后,总结了一个清晰易懂的解析过程,便于读者理解。
最低0.47元/天 解锁文章
1178

被折叠的 条评论
为什么被折叠?



