Myślę, że tego właśnie szukasz-
FOR r IN ( SELECT rownum rn, cells
FROM xmltable('/SearchOutput/rowArray/Row' passing XMLTYPE(l_xmlclob)
columns CELLS XMLTYPE PATH './cellArray') f
)
LOOP
DBMS_OUTPUT.PUT_LINE('Row: '||r.rn);
FOR c IN ( SELECT colid,
colval
FROM xmltable('for $i in /cellArray/Cell
return $i'
passing r.cells
columns COLID NUMBER PATH 'columnId',
COLVAL VARCHAR(20) PATH 'valueArray/Value[1]/value')
)
LOOP
DBMS_OUTPUT.PUT_LINE('colid, col value: '||c.colid||', '||c.colval);
END LOOP;
END LOOP;
end;
LUB
FOR r IN ( SELECT rownum rn, cells
FROM xmltable('/SearchOutput/rowArray/Row' passing XMLTYPE(l_xmlclob)
columns CELLS XMLTYPE PATH './cellArray')
)
LOOP
DBMS_OUTPUT.PUT_LINE('Row: '||r.rn);
FOR c IN ( SELECT colid, colval
FROM xmltable('/cellArray/Cell' passing r.cells
columns COLID NUMBER PATH './columnId',
COLVAL VARCHAR(20) PATH './valueArray/Value[1]/value')
)
LOOP
DBMS_OUTPUT.PUT_LINE('colid, col value: '||c.colid||', '||c.colval);
END LOOP;
END LOOP;
Wyjście-
Row: 1
colid, col value: 1, Uganda
colid, col value: 5, AZ12604823-001
colid, col value: 2, IT06686
colid, col value: 9, Hu Mics Metab K
colid, col value: 8, 2006-06-21
colid, col value: 7, 2006-07-27
Value[1]
da ci pierwszy element wielowierszowy, czyli pierwszą Value
singleton.