Jag antar att det här är vad du letar efter-
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;
ELLER
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;
Utdata-
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]
ger dig det första av flerradselementet, dvs det första Value
singel.