为什么SQLite说instr不存在?

时间:2022-06-11 10:41:25

I am trying to run a query:

我正在尝试运行查询:

SELECT name
FROM Foo 
WHERE instr(name, '@') = 0 AND instr(name, '.') != 0

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?

但我得到的错误是:“没有这样的功能:instr”。这让我感到困惑,因为该网站明确指出该功能存在。有谁知道发生了什么事?

P.S. I also tried the query in SQLiteSpy which gives the same error.

附:我也在SQLiteSpy中尝试了查询,它给出了同样的错误。

1 个解决方案

#1


17  

According to the Change History, the instr function was added in version 3.7.15:

根据Change History,在版本3.7.15中添加了instr函数:

2012-12-12 (3.7.15)

2012-12-12(3.7.15)

Added the instr() SQL function.

添加了instr()SQL函数。

Make sure you're running the latest release.

确保您运行的是最新版本。

If upgrading is not an option, you can also use the LIKE operator:

如果升级不是一个选项,您也可以使用LIKE运算符:

SELECT name
FROM Foo 
WHERE name NOT LIKE '%@%' -- name does NOT contain @
AND name LIKE '%.%';      -- name DOES contain .

#1


17  

According to the Change History, the instr function was added in version 3.7.15:

根据Change History,在版本3.7.15中添加了instr函数:

2012-12-12 (3.7.15)

2012-12-12(3.7.15)

Added the instr() SQL function.

添加了instr()SQL函数。

Make sure you're running the latest release.

确保您运行的是最新版本。

If upgrading is not an option, you can also use the LIKE operator:

如果升级不是一个选项,您也可以使用LIKE运算符:

SELECT name
FROM Foo 
WHERE name NOT LIKE '%@%' -- name does NOT contain @
AND name LIKE '%.%';      -- name DOES contain .