訪問(wèn)中作為對(duì)象關(guān)系存儲(chǔ)的XML對(duì)象的最佳方式是什么?
訪問(wèn)中作為對(duì)象關(guān)系存儲(chǔ)的XML對(duì)象的最佳方式是什么?,xml,,orm,,Xml,,Orm,,首先,我使用的是 12版本1我需要在數(shù)據(jù)庫(kù)中檢索存儲(chǔ)為對(duì)象關(guān)系的對(duì)象,但速度太慢了——我使用Dom文檔來(lái)檢索對(duì)象我正在使用的函數(shù): or ( , ) total := 0; .; .
首先,我使用的是 12版本1
我需要在數(shù)據(jù)庫(kù)中檢索存儲(chǔ)為對(duì)象關(guān)系的對(duì)象unity存儲(chǔ)數(shù)據(jù)的方法,但速度太慢了——我使用Dom文檔來(lái)檢索對(duì)象
我正在使用的函數(shù):
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;
/
我也嘗試過(guò)以下查詢。。。但它的性能更差
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;
/
是否有其他方法可以訪問(wèn)中存儲(chǔ)為對(duì)象關(guān)系對(duì)象的XML數(shù)據(jù)?一個(gè)更有效的方法。
您嘗試過(guò)為
XMLType
列編制索引嗎?謝謝unity存儲(chǔ)數(shù)據(jù)的方法,但在這種情況下不起作用。