“不是” Java / SQLite 应用程序中的语法错误
我正在开发一个带有 SQLite 数据库的 Java 应用程序。我必须执行这个查询:
select * from service
where (tache IS NOT 'I')
AND (idequiv IS null OR idequiv = '' OR idequiv<=0)
union
select * from service where (idequiv IS NOT null)
and (tache IS NOT 'I')
group by num_service
order by num_service;
这在 SQLiteStudio 中运行良好,但在我的应用程序中我得到了这个异常:
java.sql.SQLException: near "'I'": syntax error at
org.sqlite.DB.throwex(DB.java:288) at
org.sqlite.NativeDB.prepare(Native Method) at
org.sqlite.DB.prepare(DB.java:114) at
org.sqlite.PrepStmt.<init>(PrepStmt.java:37) at
org.sqlite.Conn.prepareStatement(Conn.java:231) at
org.sqlite.Conn.prepareStatement(Conn.java:224) at
org.sqlite.Conn.prepareStatement(Conn.java:213)
知道为什么吗? 我很绝望..
I'm working on an Java application with SQLite database. I have to execute this query :
select * from service
where (tache IS NOT 'I')
AND (idequiv IS null OR idequiv = '' OR idequiv<=0)
union
select * from service where (idequiv IS NOT null)
and (tache IS NOT 'I')
group by num_service
order by num_service;
This works well in SQLiteStudio, but in my application I got this exception :
java.sql.SQLException: near "'I'": syntax error at
org.sqlite.DB.throwex(DB.java:288) at
org.sqlite.NativeDB.prepare(Native Method) at
org.sqlite.DB.prepare(DB.java:114) at
org.sqlite.PrepStmt.<init>(PrepStmt.java:37) at
org.sqlite.Conn.prepareStatement(Conn.java:231) at
org.sqlite.Conn.prepareStatement(Conn.java:224) at
org.sqlite.Conn.prepareStatement(Conn.java:213)
Any Idea why ?
I'm desperate ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IS NOT
和IS
用于 NULL 值。使用<>
或NOT a = b
作为值。IS NOT
andIS
is used for NULL values. Use<>
orNOT a = b
for values.