Oracle文本catsearch一个谓词中的多个

Oracle文本catsearch一个谓词中的多个,oracle,text,Oracle,Text,我有一个表,有两列,类型为varchar2 我创建了两个索引 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(colum

我有一个表,有两列,类型为varchar2

我创建了两个索引

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
//

我怎样才能解决这个问题

谢谢


塞尔吉奥(Sergio)

有关芭芭拉·伯默(Barbara Böhmer)的评论,请参阅此。否则,请使用插入指定复制场景;例如,您当前的SQL引用表1,但DDL用于
文档o

如果您做得不对,首先,在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;
/
select * 
from documento
where contains(column1,'AAA WITHIN column1 AND BBBb WITHIN column2')>0
运行上述脚本后,即可创建索引:

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)');
您的查询可能是这样工作的:

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;
/
select * 
from documento
where contains(column1,'AAA WITHIN column1 AND BBBb WITHIN column2')>0
问候


丹尼尔

你能把前三行翻译成简单的英语吗?嗨@user3162140这有助于解决你的问题吗?如果没有,请在您的问题中添加不成功的内容。嗨,丹尼尔,谢谢您的贡献,欢迎使用Stack Overflow!不幸的是,这个问题来自2014年,不太可能有太多的流量。要查找更活跃的问题,我建议使用搜索功能查找最近的问题。你可以通过使用“最新”进行排序来搜索类似的问题。希望你这一周过得愉快@1991DBA请不要劝阻人们给出好的答案,即使这些问题已经过时了。我没有劝阻任何人给出好的答案,我只是建议他们查看最近的问题,让更多的人知道答案。请不要无端指责别人:)