SQL IN 条款 1000 项限制 [英] SQL IN Clause 1000 item limit

查看:40
本文介绍了SQL IN 条款 1000 项限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL IN 子句中可以放入 1000 多个项目吗?我们一直遇到 Oracle 数据库无法处理的问题.

It is possible to put more than 1000 items in the SQL IN clause? We have been getting issues with our Oracle database not being able to handle it.

如果是,我们如何在 SQL IN 子句中放入 1000 多个项目?

IF yes, how do we put more than 1000 items in the SQL IN clause?

如果没有,我还能做什么?

IF not, what else can I do?

推荐答案

您应该将 IN 子句转换为 INNER JOIN 子句.

You should transform the IN clauses to INNER JOIN clauses.

您可以像这样转换查询

SELECT  foo   
FROM    bar   
WHERE bar.stuff IN  
       (SELECT  stuff FROM asdf)

在像另一个这样的查询中.

in a query like this other one.

SELECT  b.foo 
FROM    ( 
        SELECT  DISTINCT stuff 
        FROM    asdf ) a 
JOIN    bar b 
ON      b.stuff = a.stuff

你也会获得很多性能

这篇关于SQL IN 条款 1000 项限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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