Oracle CONTAINS提供了无效的标识符ORA-00904 [英] Oracle CONTAINS Giving Invalid Identifier ORA-00904

查看:1036
本文介绍了Oracle CONTAINS提供了无效的标识符ORA-00904的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我有一个webapp,其中包含一个字符串,其中ID元素用'-'分隔(例如 someid1-someid2 )。然后,我将该字符串转换为 someid1或someid2 之类的东西。理论上,根据 Oracle文档然后我要做类似的事情

So I have a webapp that takes in a string where ID elements are broken up by '-' (e.g. someid1-someid2). I then convert the string to something like someid1 OR someid2. This in theory according to Oracle's doc's should allow me to then do something like

SELECT somecol1, somecol2 FROM sometable WHERE CONTAINS (somecol1, 'someid1 OR someid2') > 0;

但是在SQL Dev中运行示例查询时出现以下错误:

However I'm getting the following error when running the sample query in SQL Dev:


ORA-00904: CONTAINS:无效的标识符

00904。00000-%s:无效的标识符

*原因:

*操作:

ORA-00904: "CONTAINS": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:

Oracle的版本为 Oracle9i Enterprise Edition 9.2.0.5.0版-该文档所针对的生产版本,所以我不明白为什么将 CONTAINS 视为不合法的识别符。添加其他可选参数

The version of Oracle is Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production of which the documentation is for, so I don't see why CONTAINS would be considered an invalid identifier. Adding the other optional parameter

SELECT somecol1, somecol2 FROM sometable WHERE CONTAINS (somecol1, 'someid1 OR someid2', 1) > 0;

也给出相同的错误。我/它在这里做错了什么?

also gives the same error. What am I/it doing wrong here?

编辑:

根据要求工作代码,尽管可以说是这样不能正常工作


'Working Code' as per request although arguably it isn't working

SELECT tech, product FROM tech_det_view WHERE CONTAINS (tech, 'test OR qual') > 0;


推荐答案

您应创建 oracle文本索引,然后使用 CONTAINS 函数

You should create oracle text index before using CONTAINS function

CREATE INDEX idxName ON tableName(columnName) INDEXTYPE IS CTXSYS.CONTEXT;

此处 ,您可以找到有关 Oracle Text 的更多信息。

这篇关于Oracle CONTAINS提供了无效的标识符ORA-00904的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆