Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String Oracle-查询以检索同名多标签下的CLOB值_String_Oracle_Clob_Xmltype - Fatal编程技术网

String Oracle-查询以检索同名多标签下的CLOB值

String Oracle-查询以检索同名多标签下的CLOB值,string,oracle,clob,xmltype,String,Oracle,Clob,Xmltype,我有一个带有CLOB列的表T,名为XML\u CLOB 列中的值如下所示: <reportName> <string>REPORT_A</string> <string>REPORT_B</string> <string>REPORT_C</string> </reportName> 它在同一行中输出类似“REPORT\u AREPORT\u BREPORT\u C” 我也试过了 extrac

我有一个带有CLOB列的表T,名为XML\u CLOB

列中的值如下所示:

<reportName>
 <string>REPORT_A</string>
 <string>REPORT_B</string>
 <string>REPORT_C</string>
</reportName>
它在同一行中输出类似“REPORT\u AREPORT\u BREPORT\u C”

我也试过了 extractValuexmltypexml_clob,'//reportName/string[1]' 但问题是我不知道标签下有多少子值

我是否可以在不同的行中检索,如: 1报告A 2报告B 3报告C

非常感谢~

Oracle安装程序:

问题2:

输出:

Oracle安装程序:

问题2:

输出:


谢谢你做了很多期待的工作谢谢你做了很多期待的工作
xmltype(xml_clob).extract('//reportName/string/text()').getstringval() 
CREATE TABLE table_name (xml_clob CLOB );

INSERT INTO table_name VALUES ( 
'<reportName>
 <string>REPORT_A</string>
 <string>REPORT_B</string>
 <string>REPORT_C</string>
</reportName>'
);
SELECT  x.string
FROM    table_name t,
        XMLTable('/reportName/string'
          PASSING XMLType( t.xml_clob )
          COLUMNS string VARCHAR2(50) PATH '/'
        ) x 
SELECT EXTRACTVALUE( s.COLUMN_VALUE, '/string' ) AS string
FROM   table_name t,
       TABLE(
         XMLSequence(
           EXTRACT(
             XMLType( t.xml_clob ),
             '/reportName/string'
           )
         )
       ) s;
STRING
--------
REPORT_A
REPORT_B
REPORT_C
WITH test_table AS
  (SELECT xmltype('<reportName> 
<string>REPORT_A</string> 
<string>REPORT_B</string> 
<string>REPORT_C</string>
</reportName>' ) xml_clob
  FROM dual
  )
SELECT x.*
FROM test_table,
  xmltable('/reportName/string' 
  passing test_table.xml_clob 
  columns report_name VARCHAR2(100) path 'text()') x