解决Orcale in超过1000个时出现“列表中的最大表达式数为 1000”这个异常的问题

第一种使用方法是

select * from table where id in (1, 2, ..., 1000) or id in(1001, ....., 1999)

第二种

select *
  from table
 where id in (1, 2, .. ., 1000)
union all
select *
  from table
 where id in (1001, .... ., 1999)

第三种

因为前两种查询效率太低

现在先把这 2000 个值写到一个临时表中,直接 in 一个子查询

SQL code
?
1
select  from  where  id  in  ( select  id  from  table  )

你可能感兴趣的:(解决Orcale in超过1000个时出现“列表中的最大表达式数为 1000”这个异常的问题)