使用 Oracle 数据库中的 SQL 从 XML Clob 中提取数据
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13600480/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 12:20:35 来源:igfitidea点击:
Extract data from XML Clob using SQL from Oracle Database
提问by user1859050
I want to extract the value of Decision using sql from table TRAPTABCLOB having column testclob with XML stored as clob.
我想使用 sql 从表 TRAPTABCLOB 中提取 Decision 的值,该表具有以 XML 存储为 clob 的列 testclob。
Sample XML as below.
示例 XML 如下。
<?xml version="1.0" encoding="UTF-8"?>
<DCResponse>
<Status>Success</Status>
<Authentication>
<Status>Success</Status>
</Authentication>
<ResponseInfo>
<ApplicationId>5701200</ApplicationId>
<SolutionSetInstanceId>
63a5c214-b5b5-4c45-9f1e-b839a0409c24
</SolutionSetInstanceId>
<CurrentQueue />
</ResponseInfo>
<ContextData>
<!--Decision Details Start-->
<Field key="SoftDecision">A</Field>
<Field key="**Decision**">1</Field>
<Field key="NodeNo">402</Field>
<Field key="NodeDescription" />
<!--Decision Details End-->
<!--Error Details Start-->
<Field key="ErrorResponse">
<Response>
<Status>[STATUS]</Status>
<ErrorCode>[ERRORCODE]</ErrorCode>
<ErrorDescription>[ERRORDESCRIPTION]</ErrorDescription>
<Segment>[SEGMENT]</Segment>
</Response>
</Field>
<Field key="ErrorCode">0</Field>
<Field key="ErrorDescription" />
</ContextData>
</DCResponse>
回答by A.B.Cade
回答by A. Gilfrin
This should work
这应该工作
SELECT EXTRACTVALUE(column_name, '/DCResponse/ContextData/Decision') FROM traptabclob;
I have assumed the ** were just for highlighting?
我假设 ** 只是为了突出显示?