SQLite: Error "no such function: INSTR"
Question by Compi | 2017-08-19 at 11:41
I am getting a strange error when using the function INSTR() in SQLite. When executing a query like SELECT id FROM tab WHERE INSTR(txt, 'abc') > 0 for example, I get the error message "no such function: instr".
According to the SQLite documentation, SQLite has the function INSTR() and as far as I can estimate, also the syntax of my query should be correct. So, what could be the reason that this is not working? I really do not know what I am doing wrong here.
Related Topics
PHP: Error "Call to undefined function now()"
Question | 1 Answer
"G" or "E" sign on my mobile
Question | 1 Answer
Solve Error "The Directory is not empty" (0x80070091)
Question | 1 Answer
HTML5 Validator: Element "link" is missing required attribute "property"
Question | 1 Answer
HTML Validation: UL in UL causes error "ul not allowed as child of element ul in this context"
Question | 1 Answer
SQLite: IF(a, b, c) Syntax not working
Question | 1 Answer
YouTube shows error "Incorrect certificate for host"
Question | 1 Answer
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
The INSTR-function was introduced with SQLite version 3.7.15. Probably you are using an older version of SQLite in which the function has not been implemented yet. This is also how to explain this error: SQLite is not knowing this function yet.
For finding out your SQLite version, you can use the following query which will display it:
Now you can do two things. Either you are updating your SQLite to a higher version (for example with getting the newest DLL or your required other library from the website of SQLite) or you're using another function that is already available in your SQLite version. For example, instead of INSTR, you can also use LIKE:
This statement would correspond to your query "SELECT id FROM tab WHERE INSTR(txt, 'abc') > 0". However, please consider that LIKE is working independent from uppercase and lowercase writing (case insensitive) while INSTR is caring about the writing (case sensitive). So, your "abc" will not match "Abc" with INSTR, while LIKE is matching it.
2017-08-19 at 16:16