• <i id='nYhIk'><tr id='nYhIk'><dt id='nYhIk'><q id='nYhIk'><span id='nYhIk'><b id='nYhIk'><form id='nYhIk'><ins id='nYhIk'></ins><ul id='nYhIk'></ul><sub id='nYhIk'></sub></form><legend id='nYhIk'></legend><bdo id='nYhIk'><pre id='nYhIk'><center id='nYhIk'></center></pre></bdo></b><th id='nYhIk'></th></span></q></dt></tr></i><div id='nYhIk'><tfoot id='nYhIk'></tfoot><dl id='nYhIk'><fieldset id='nYhIk'></fieldset></dl></div>
      <bdo id='nYhIk'></bdo><ul id='nYhIk'></ul>

    <legend id='nYhIk'><style id='nYhIk'><dir id='nYhIk'><q id='nYhIk'></q></dir></style></legend>
    1. <small id='nYhIk'></small><noframes id='nYhIk'>

        <tfoot id='nYhIk'></tfoot>
      1. 通过 SQL 从 Oracle 中的 clob 中提取 XML 子标签

        时间:2023-06-06

        <small id='J0qmV'></small><noframes id='J0qmV'>

        <tfoot id='J0qmV'></tfoot>
          <tbody id='J0qmV'></tbody>
        <i id='J0qmV'><tr id='J0qmV'><dt id='J0qmV'><q id='J0qmV'><span id='J0qmV'><b id='J0qmV'><form id='J0qmV'><ins id='J0qmV'></ins><ul id='J0qmV'></ul><sub id='J0qmV'></sub></form><legend id='J0qmV'></legend><bdo id='J0qmV'><pre id='J0qmV'><center id='J0qmV'></center></pre></bdo></b><th id='J0qmV'></th></span></q></dt></tr></i><div id='J0qmV'><tfoot id='J0qmV'></tfoot><dl id='J0qmV'><fieldset id='J0qmV'></fieldset></dl></div>

          • <bdo id='J0qmV'></bdo><ul id='J0qmV'></ul>

                  <legend id='J0qmV'><style id='J0qmV'><dir id='J0qmV'><q id='J0qmV'></q></dir></style></legend>
                • 本文介绍了通过 SQL 从 Oracle 中的 clob 中提取 XML 子标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我在数据库属性object_body"中有以下 CLOB XML 片段:

                  <object stamp="8fc630bd-f1f5-43ac-b9d2-3b9db9054c75_1481811010527" type="Aggregation" version="12">
                    <property name="name" value="COA_Cash_Position" valueType="string"/>
                    <property name="description" value="COA_Cash_Position" valueType="string"/>
                    <property name="objectId" value="ef4296f1-6af6-4de8-83fe-fa01cf327d87" valueType="string"/>
                    <property name="branchId" value="01ecc9ed-27f3-42cb-a44d-2cec221ec8fa" valueType="string"/>
                    <property name="models" valueType="table">
                      <object type="ModelBasedTask:modelEntry" version="3">
                        <property name="dataModel" valueType="url">DataModel["ModifyModel[COA_Cash_Positions_BHS_Unadjusted].STAGING:X_NRS_BSL40K_BHS"{ModifyModel[ff81e5f2-2ef6-437a-b113-67f7c0dd5e53].cdf308fc-520d-4611-a8db-4e6863e216b8:9ffcd08e-732a-4270-b15f-f4775bcc69db}]</property>
                        <property name="instanceSelectionRule" valueType="object">
                          <object type="InstanceSelectionRule" version="3">
                            <property name="instanceDateRule" valueType="object">
                              <object type="InstanceSelectionRule:rule" version="3">
                                <property name="type" value="EQUAL" valueType="string"/>
                              </object>
                            </property>
                            <property name="instanceKeyRules" valueType="table"/>
                          </object>
                        </property>
                      </object>
                    </property>
                  </object>
                  

                  目的是提取name="description"的属性标签的值
                  => 生成COA_Cash_Position"

                  Aim is to extract the value of the property tag with name="description"
                  => to produce "COA_Cash_Position"

                  尝试了以下所有变体:

                  EXTRACTVALUE(xmltype(object.object_body), '/object/property[@name="description"].getStringVal()'),
                  

                  如果我丢失了 .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 中已弃用 - 它正在被 XMLTABLEXMLQUERY.

                  SELECT x.description
                  FROM   your_table t
                         CROSS JOIN
                         XMLTABLE(
                           '//object/'
                           PASSING XMLTYPE( t.your_clob_column )
                           COLUMNS description VARCHAR2(4000) PATH './property[@name="description"]/@value'
                         ) x;
                  

                  SELECT XMLQUERY(
                           '//object/property[@name="description"]/@value'
                           PASSING XMLTYPE( your_clob_column )
                           RETURNING CONTENT
                         ).getStringVal()
                  FROM   your_table;
                  

                  但是如果你确实想使用 EXTRACTVALUE 你可以这样做:

                  But if you do want to use EXTRACTVALUE you can do:

                  SELECT EXTRACTVALUE(
                           XMLTYPE( your_clob_column ),
                           '//object/property[@name="description"]/@value'
                         )
                  FROM   your_table;
                  

                  这篇关于通过 SQL 从 Oracle 中的 clob 中提取 XML 子标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Windows 7 32 位上安装 Xampp.启动时的错误 下一篇:如何将 XML 查询结果保存到文件

                  相关文章

                  最新文章

                  <tfoot id='kWF94'></tfoot>

                    <small id='kWF94'></small><noframes id='kWF94'>

                    <i id='kWF94'><tr id='kWF94'><dt id='kWF94'><q id='kWF94'><span id='kWF94'><b id='kWF94'><form id='kWF94'><ins id='kWF94'></ins><ul id='kWF94'></ul><sub id='kWF94'></sub></form><legend id='kWF94'></legend><bdo id='kWF94'><pre id='kWF94'><center id='kWF94'></center></pre></bdo></b><th id='kWF94'></th></span></q></dt></tr></i><div id='kWF94'><tfoot id='kWF94'></tfoot><dl id='kWF94'><fieldset id='kWF94'></fieldset></dl></div>

                      • <bdo id='kWF94'></bdo><ul id='kWF94'></ul>

                      <legend id='kWF94'><style id='kWF94'><dir id='kWF94'><q id='kWF94'></q></dir></style></legend>