我试图让一个过程发布XMLType字段的内容,但是我在select语句上得到了DRG-10599(尽管应该根据存储在所述XML中的书名来选择一行。列同时具有XMLIndex和CTXSYS.Context索引。
我多次检查了XML结构,并尝试将不同的结构写成摘录。我还是一样。我怀疑路径可能有问题,但是我不确定这是什么原因,因为我不太擅长PLSQL,并且我所提供的示例未提供索引代码。
XMLType列:
<bookspec>
<title>
Lord of the Rings - The Fellowship of the Ring
</title>
<author>
JRR Tolkien
</author>
<genre>
fantasy
</genre>
<summary>
Continuing the story begun in The Hobbit, this is the first part of Tolkien's epic masterpiece, The Lord of the Rings, featuring a striking black cover based on Tolkien's own design, the definitive text, and a detailed map of Middle-earth. Sauron, the Dark Lord, has gathered to him all the Rings of Power - the means by which he intends to rule Middle-earth. All he lacks in his plans for dominion is the One Ring - the ring that rules them all - which has fallen into the hands of the hobbit, Bilbo Baggins. In a sleepy village in the Shire, young Frodo Baggins finds himself faced with an immense task, as his elderly cousin Bilbo entrusts the Ring to his care. Frodo must leave his home and make a perilous journey across Middle-earth to the Cracks of Doom, there to destroy the Ring and foil the Dark Lord in his evil purpose. Now published again in B format, J.R.R. Tolkien's great work of imaginative fiction has been labelled both a heroic romance and a classic fantasy fiction. By turns comic and homely, epic and diabolic, the narrative moves through countless changes of scene and character in an imaginary world which is totally convincing in its detail.
</summary>
</bookspec>
过程:
procedure BookView(BookName IN varchar2) is
tmp_info clob;
tmp_spec clob;
book_id number;
begin
dbms_lob.createtemporary(tmp_info, true);
select b.BookID, b.spec.getCLOBVal() into book_id, tmp_spec from Books b where contains(b.spec.extract('/bookspec/title/text()'), BookName) > 0;
dbms_lob.append(tmp_info, '<books>');
dbms_lob.append(tmp_info, '<book>');
dbms_lob.append(tmp_info, tmp_spec);
dbms_lob.append(tmp_info, '</book>');
dbms_lob.append(tmp_info, '</books>');
dbms_output.put_line(tmp_info);
dbms_lob.freetemporary(tmp_info);
end BookView;
索引:
create index BookSpecIndex on Books(spec)
indextype is xdb.xmlindex;
alter index BookSpecIndex rebuild parameters('paths (inlude add(/books/book/bookspec//*))');
alter index BookSpecIndex rebuild parameters('paths (inlude add(/book/bookspec//*))');
alter index BookSpecIndex rebuild parameters('paths (inlude add(/bookspec//*))');
alter index BookSpecIndex rebuild parameters('paths (inlude add(/books/book//*))');
alter index BookSpecIndex rebuild parameters('paths (inlude add(/book//*))');
CREATE INDEX BookTextIndex on Books(Spec) INDEXTYPE IS CTXSYS.CONTEXT;
该过程应该打印出所说的XML,但是它总是一直提供DRG-10599。