oracle中in不能超过1000的解决方案

oracle当IN中数据条数超过1000会出现异常

  1. 在in中在拼一个括号,数字1开头即可 “(1,?)”
select * from person where (1,name) in (
		(1,'小明'),(1,'小李'),
		(1,'小黄'),(1,'小黑'),
		(1,?),......,(1,?)
	);
  1. 使用union all拼接
select * from person where id
(1,2,3,4,5,.......,999,1000)
union
select * from person where id
(1001,1002,1003,.......,1999,2000)
  1. 使用or分割
select * from Person where 
id in (1,2,3,....,999,1000) 
or 
id in (1001,1002,1003,...,1999,2000)

猜你喜欢

转载自blog.csdn.net/Lilayzzz/article/details/108330948
今日推荐