Sqlite:'in'子句中可以有多少个参数 [英] Sqlite : How many parameters can there be in an 'in' clause

查看:1181
本文介绍了Sqlite:'in'子句中可以有多少个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想执行以下操作:

delete from images where image_address not in (<a long list>) 

此列表可以多长时间? (我猜我可能要考虑另一种方式)。

How long can this list be? (I'm guessing I might have to think of another way).

推荐答案

如果您使用参数(),默认最大数量为999

If you are using parameters (?), the maximum number is 999 by default.

如果通过直接插入值来动态创建SQL语句(这对字符串来说是一件坏事),这样的列表的长度没有上限。但是,限制整个SQL语句的长度,即100万默认情况下为字节。

If you are creating the SQL statement dynamically by inserting the values directly (which is a bad thing to do for strings), there is no upper limit on the lenght of such a list. However, there is a limit on the length of the entire SQL statement, which is one million bytes by default.

如果您不能保证查询不超过这些限制,则必须使用临时表(请参阅LS_dev的答案)。

If you cannot guarantee that your query does not exceed these limits, you must use a temporary table (see LS_dev's answer).

这篇关于Sqlite:'in'子句中可以有多少个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆