Why does SQLite say that instr doesnt exist?

后端 未结 1 370
慢半拍i
慢半拍i 2021-01-11 13:30

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 functio

1条回答
  •  孤街浪徒
    2021-01-11 13:53

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

    2012-12-12 (3.7.15)

    Added the instr() SQL function.

    Make sure you're running the latest release.

    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 .
    

    0 讨论(0)
提交回复
热议问题