搜索长 varchar SQL
我有一个 Ingres 9.2.0 数据库,其中包含一个长 varchar 列。有什么方法可以在该列中搜索特定字符串,并仅返回该列中包含该字符串的行。
我尝试使用如下
select * from table
where col like '%abc%'
但出现以下错误
未为“long varchar”类型的参数定义函数“like” 和“varchar”。显式地将其参数转换为所需的参数 类型。
我能够通过以下查询解决此问题
从表中选择* WHERE 位置(col 中的“abc”)> 0
I have a database in Ingres 9.2.0 that contains a long varchar column. Is there any way that I can search this column for a specific string and only return the rows that contain have that string in the column.
I tried using like as follows
select * from table
where col like '%abc%'
but I get the following error
Function 'like' is not defined for arguments of type 'long varchar'
and 'varchar'. Explicitly convert its arguments to the desired
type(s).
I was able to resolve this with the following query
select * from table
WHERE position('abc' in col) > 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Ingres 9.3.0 中添加了对 LONG VARCHAR 的 LIKE 支持(项目页面 - 如果您有早期版本这不起作用。请参阅 所有 9.3 更改的功能列表。
Support for LIKE against LONG VARCHAR was added to Ingres 9.3.0 (project page - If you have an earlier release this won't work.See the feature list for all 9.3 changes.