XMLType フィールドを持つ表があります。テーブルは、次の DDL/DML を使用して作成およびロードされます。
CREATE TABLE T_ECO_test_LOG
(
SECID NUMBER NOT NULL,
LOG_ATTRIBUTES SYS.XMLTYPE
)
INSERT INTO t_eco_test_log VALUES
( 1, XMLType(
'<attributes>
<attribute>
<name>remoteAddress</name>
<value>180.201.106.130</value>
</attribute>
<attribute>
<name>domain</name>
<value>BSI_US</value>
</attribute>
</attributes>'));
INSERT INTO t_eco_test_log VALUES
( 2, XMLType(
'<attributes>
<attribute>
<name>user</name>
<value>xxxx</value>
</attribute>
<attribute>
<name>domain</name>
<value>BSI_US</value>
</attribute>
</attributes>'));
/attributes/attribute/name のさまざまな値を行で取得したい。したがって、Oが取得したいデータは次のとおりです。
remoteAddress
domain
user
これまでのところ、次のクエリを試しました。
select extractValue(value(x),'/attributes/attribute/name')
from t_eco_log,
table(xmlsequence(extract(log_attributes,'/attributes')) )x
しかし、次のメッセージが表示されます。
ORA-19025: EXTRACTVALUEは1つのノードのみの値を返します
私が使用する場合
select extract(value(x),'/attributes/attribute/name')
from t_eco_log,
table(xmlsequence(extract(log_attributes,'/attributes')) )x
以下を含む XML 結果を取得しました。
<name>remoteAddress</name><name>domain</name>
しかし、それらを行として取得したいのですが、どうすればよいですか?
ティア