ORA-29902:执行 ODCIIndexStart() 例程时出错 ORA-20000:Oracle 文本错误:DRG-50901:第 1 行第 19 列的文本查询解析器语法错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26757387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:36:15  来源:igfitidea点击:

ORA-29902: error in executing ODCIIndexStart() routine ORA-20000: Oracle Text error: DRG-50901: text query parser syntax error on line 1, column 19

oracletext

提问by Francis John

SELECT person_no sub_sys_individual_id,
 nm_e,
 nm_a,
 nvl(sex, -1) sex,
nvl(prs_nat, -999) prs_nat,
person_no,
'NA' prog_where_not_allowed,
'NA' udb_no,
 person_tp,
 pass_no
FROM ban_inq_tab
WHERE contains (nm_e ,'xxstart JUHETI BT MEMED ASMANI%') >0
AND (trans_flag IS NULL OR trans_flag = 'C');

please help me in this issue and getting parser syntax error

请帮助我解决这个问题并获取解析器语法错误

采纳答案by markgiaconia

FYI, you'll also get this error (i'm on Oracle 12.2) if you have the input parameter to a stored proc that will be the query in a contains predicate as an NVARCHAR2. So if you have input params to a stored proc as NVARCHAR2 and that parameter is destined for the query in the contains predicate, then change it to VARCHAR (or maybe CLOB) and it will no longer throw this error.

仅供参考,如果您有存储过程的输入参数,您也会收到此错误(我在 Oracle 12.2 上),该参数将作为 NVARCHAR2 包含谓词中的查询。因此,如果您已将存储过程的输入参数作为 NVARCHAR2 输入,并且该参数用于包含谓词中的查询,则将其更改为 VARCHAR(或可能是 CLOB),它将不再抛出此错误。

回答by mikron

The error is causing the BT, which is a reserved word. The solution is described in the Oracle Community forum.

该错误导致 BT,这是一个保留字。该解决方案在Oracle 社区论坛中有所描述。

回答by mmmmmpie

You must escape the BT special word (but you can just escape the entire string).

您必须转义 BT 特殊字(但您可以转义整个字符串)。

SELECT person_no sub_sys_individual_id,
 nm_e,
 nm_a,
 nvl(sex, -1) sex,
nvl(prs_nat, -999) prs_nat,
person_no,
'NA' prog_where_not_allowed,
'NA' udb_no,
 person_tp,
 pass_no
FROM ban_inq_tab
WHERE contains (nm_e ,'{xxstart JUHETI BT MEMED ASMANI}%') >0
AND (trans_flag IS NULL OR trans_flag = 'C');