Я пытаюсь, чтобы процедура опубликовала содержимое поля XMLType, но я получаю DRG-10599 в операторе select (который должен выбирать строку в соответствии с названием книги, хранящимся в указанном 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 все время.