SQL:大小写限制(WHEN,THEN条件的数量) [英] SQL: Limit on CASE (number of WHEN, THEN conditions)
本文介绍了SQL:大小写限制(WHEN,THEN条件的数量)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑查询(它同时在Oracle和MySQL上运行)
Consider the query (it runs on both Oracle and MySQL)
UPDATE table1
SET something_id = CASE
WHEN table1_id = 1446 THEN 423
WHEN table1_id = 2372 THEN 426
WHEN table1_id = 2402 THEN 428
WHEN table1_id = 2637 THEN 429
WHEN table1_id = 2859 THEN 430
WHEN table1_id = 3659 THEN 433
END
WHERE table1_id IN (1446,2372,2402,2637,2859,3659)
该查询可能会变得非常大,所以我想知道单个查询可以容纳的条件数(WHEN,THEN语句)的限制是多少?有办法解决吗?
This query can get quite large, so I was wondering what is the limit on the number of conditions (WHEN, THEN statements) a single query can hold. Is there a way around it?
例如:
我知道可以传递给IN
的值的最大数量为1000,要克服这一点,我们可以做到
For example:
I know that the max number of values that can be passed to IN
is 1000 and to overcome this we can do
`WHERE TABLE1_ID IN ([1000 values]) OR TABLE1_ID IN ([more values])`
推荐答案
查看全文