搜索长 varchar SQL

发布于 2024-12-21 01:44:29 字数 390 浏览 4 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自找没趣 2024-12-28 01:44:29

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文