为什么 SQLite 说 instr 不存在? [英] Why does SQLite say that instr doesnt exist?
本文介绍了为什么 SQLite 说 instr 不存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试运行查询:
SELECT name
FROM Foo
WHERE instr(name, '@') = 0 AND instr(name, '.') != 0
但我收到错误消息:没有这样的功能:instr".这让我很困惑,因为网站明确声明该功能存在.有人知道是怎么回事吗?
But I am getting the error: "no such function: instr". This confuses me because the website clearly states that the function exists. Anyone know what is going on?
附言我还尝试了 SQLiteSpy 中的查询,它给出了同样的错误.
P.S. I also tried the query in SQLiteSpy which gives the same error.
推荐答案
根据更改历史,instr
函数是在 3.7.15 版本中添加的:
According to the Change History, the instr
function was added in version 3.7.15:
2012-12-12 (3.7.15)
添加了 instr() SQL 函数.
Added the instr() SQL function.
确保您运行的是最新版本.
Make sure you're running the latest release.
如果升级不是一种选择,您也可以使用 LIKE
运算符:
If upgrading is not an option, you can also use the LIKE
operator:
SELECT name
FROM Foo
WHERE name NOT LIKE '%@%' -- name does NOT contain @
AND name LIKE '%.%'; -- name DOES contain .
这篇关于为什么 SQLite 说 instr 不存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文