XMLType オブジェクトがあり、営業時間をテーブルに抽出したいと考えています。
<workspace>
<title>workspace1</title>
<item>
<day>1</day>
<openingTime>8:00</openingTime>
<closingTime>12:00</closingTime>
</item>
<item>
<day>1</day>
<openingTime>13:00</openingTime>
<closingTime>18:00</closingTime>
</item>
<workspace>
<workspace>
<title>workspace2</title>
<item>
<day>1</day>
<openingTime>9:00</openingTime>
<closingTime>14:00</closingTime>
</item>
<item>
<day>3</day>
<openingTime>12:00</openingTime>
<closingTime>16:00</closingTime>
</item>
<workspace>
私は次のようなものを使用します:
SELECT ExtractValue(Value(p),'workspace/item/day/text()') as day
,ExtractValue(Value(p),'workspace/item/openingTime/text()') as open
,ExtractValue(Value(p),'workspace/item/closingTime/text()') as close
FROM TABLE (XMLSequence(Extract(y,'workspace'))) p
WHERE ExtractValue(Value(p),'/workspace/title/text()') LIKE 'workspace1';
ここで、yは上記の XMLType です。ただし、複数の項目ノードが検出されるため、これは機能しません。タイトル Workspace2 のすべての要素値 (値 1、9:00、14:00、3、12:00、16:00) を抽出する必要があります。値だけでなく、XMLType の全体を抽出できれば助かります。何か案は?
ありがとう、ミハル