gpt4 book ai didi

Oracle text catsearch 多合一谓词

转载 作者:行者123 更新时间:2023-12-03 17:18:44 24 4
gpt4 key购买 nike

我有一个带有 2 列 varchar2 类型的表。

我创建了 2 个 indeces

CREATE INDEX DOC_IDX_1 
ON DOCUMENTO
( column1
)
INDEX TYPE IS CTXSYS.CTXCAT
;
CREATE INDEX DOC_IDX_2
ON DOCUMENTO
( column2
)
INDEX TYPE IS CTXSYS.CTXCAT
;

当我执行查询时
select * 
from table1
where CATSEARCH(column1, 'AAA', NULL) > 0
AND CATSEARCH(column2 , 'BBBb', NULL) > 0

我收到以下错误
ORA-20000: Oracle Text error:
DRG-10849: catsearch non supporta il richiamo funzionale
DRG-10599: la colonna non è indicizzata
20000. 00000 - "%s"
*Cause: The stored procedure 'raise_application_error'
was called which causes this error to be generated.
*Action: Correct the problem as described in the error message or contact
the application administrator or DBA for more information.

英文翻译是:
$ oerr drg 10849
10849,0, "catsearch does not support functional invocation"
// *Cause: the query plan for your query is invoking a catsearch operator
// functionally rather than as an index rowsource. The catsearch
// operator does not support functional invocation
// *Action: add optimizer hints so that all catsearch operators are
// performed through index scans
// *Mnemonic: QE_CATSEARCH_FUNCINV
//


10599,0, "column is not indexed"
// *Cause: The column specified is not indexed.
// *Action: Create index on the column before performing this operation
// *Mnemonic: DL_COLUMN_NOT_INDEXED

我该如何解决这个问题?

谢谢

塞尔吉奥

最佳答案

你做错了,首先,在 ctxsys 模式中,你应该这样设置首选项:

begin
ctx_ddl.create_preference('my_documents', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('my_documents', 'COLUMNS', 'column1, column2');
ctx_ddl.create_preference('my_documents_lexer', 'BASIC_LEXER'); /* I strongly recommend you this preference*/
ctx_ddl.set_attribute('my_documents_lexer', 'BASE_LETTER', 'YES');
end;
/

运行上面的脚本后,您就可以创建索引:
create index DOC_IDX on DOCUMENTO(column1) indextype is ctxsys.context
parameters ('DATASTORE ctxsys.my_documents section group CTXSYS.AUTO_SECTION_GROUP LEXER ctxsys.my_documents_lexer SYNC(on commit)');

您的查询可能以这种方式工作:
select * 
from documento
where contains(column1,'AAA WITHIN column1 AND BBBb WITHIN column2')>0

问候

丹尼尔

关于Oracle text catsearch 多合一谓词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20931676/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com