訪問中作為對象關系存儲的XML對象的最佳方式是什么?
訪問中作為對象關系存儲的XML對象的最佳方式是什么?,xml,,orm,,Xml,,Orm,,首先,我使用的是 12版本1我需要在數據庫中檢索存儲為對象關系的對象,但速度太慢了——我使用Dom文檔來檢索對象我正在使用的函數: or ( , ) total := 0; .; .
首先,我使用的是 12版本1
我需要在數據庫中檢索存儲為對象關系的對象unity存儲數據的方法,但速度太慢了——我使用Dom文檔來檢索對象
我正在使用的函數:
create or replace FUNCTION XML_myDistance(
innXML XMLType,
outXML XMLType
) RETURN number
IS
total NUMBER := 0;
docInn xmldom.DOMDocument;

docOut xmldom.DOMDocument;
nInn xmldom.DOMNode;
nOut xmldom.DOMNode;
nlInn xmldom.DOMNodeList;
nlOut xmldom.DOMNodeList;
len number;
BEGIN
--Converte os atributos xmltype para DOMDocuments.
docInn := dbms_xmldom.newDOMDocument(innXML);
docOut := dbms_xmldom.newDOMDocument(outXML);
nlInn := xmldom.getElementsByTagName(docInn, '*');

nlOut := xmldom.getElementsByTagName(docOut, '*');
len := xmldom.getLength(nlInn);
for i in 1..len-1 loop
nInn := xmldom.item(nlInn, i);
nOut := xmldom.item(nlOut, i);
total := total + ABS(xmldom.getNodeValue(DBMS_XMLDOM.getFirstChild(nInn)) - xmldom.getNodeValue(DBMS_XMLDOM.getFirstChild(nOut)));
end loop;
DBMS_XMLDOM.freeDocument(docInn);
DBMS_XMLDOM.freeDocument(docOut);

RETURN total;
END;
/
我也嘗試過以下查詢。。。但它的性能更差
create or replace FUNCTION myDistance(
innXML XMLType,
outXML XMLType
) RETURN number
IS
total NUMBER;
BEGIN

SELECT SUM( ABS(oFV.feature - iFV.feature) )
INTO total
FROM XMLTABLE(
'//FeatureVector/feature'
PASSING outXML
COLUMNS rn FOR ORDINALITY,
feature NUMBER PATH '.'
) oFV
INNER JOIN
XMLTABLE(
'//FeatureVector/feature'
PASSING innXML

COLUMNS rn FOR ORDINALITY,
feature NUMBER PATH '.'
) ifv
ON ( oFV.rn = iFV.rn );
RETURN total;
END;
/
是否有其他方法可以訪問中存儲為對象關系對象的XML數據?一個更有效的方法。
您嘗試過為
XMLType
列編制索引嗎?謝謝unity存儲數據的方法,但在這種情況下不起作用。