问题描述
我在数据库属性object_body"中有以下 CLOB XML 片段:
目的是提取name="description"的属性标签的值
=> 生成COA_Cash_Position"
Aim is to extract the value of the property tag with name="description"
=> to produce "COA_Cash_Position"
尝试了以下所有变体:
如果我丢失了 .getStringVal() 查询有效,但显然只提供空结果(因为属性标签本身不包含任何值).
If I loose the .getStringVal() the query works but obviously only provides empty results (as the property tag itself doesn't include any value).
获取大部分错误消息,例如:
Get mostly error messages the likes of:
ORA-31011:XML 解析失败ORA-19202: XML 处理出错LPX-00601:无效令牌:'/object/property[@name="description"].getStringVal()'
ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: '/object/property[@name="description"]. getStringVal()'
最简单的方法是提取两个 xml 标记之间的值,但获取特定的属性值(例如这里的 name="description" 标记的值") 似乎规避了 XML 提取的可能性.
What easily works is extracting the values between two xml tags but getting a specific property value (like here the "value" of the tag with name="description") seems to evade the XML extract possibilities.
热烈感谢任何帮助...
Any help is warmly appreciated...
推荐答案
EXTRACTVALUE
在 Oracle 12 中已弃用 - 它正在被 XMLTABLE
或 XMLQUERY
.
或
但是如果你确实想使用 EXTRACTVALUE
你可以这样做:
But if you do want to use EXTRACTVALUE
you can do:
这篇关于通过 SQL 从 Oracle 中的 clob 中提取 XML 子标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!