Oracle java.sql.SQLSyntaxErrorException: ORA-01795: 列表中的最大表达式数为 1000

时间:2021-07-21
本文章向大家介绍Oracle java.sql.SQLSyntaxErrorException: ORA-01795: 列表中的最大表达式数为 1000,主要包括Oracle java.sql.SQLSyntaxErrorException: ORA-01795: 列表中的最大表达式数为 1000使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Oracle   语法  in   后集合 不能超过1000, 

select  *  from   table   where  id in   (  '1' , '  ', '   ',.........,'1000')   

解决方式

1、分多次查询,最大不超过 1000, 然后将结果汇总

2、把参数分开 一次查询 

  select   *  from  table where id  in (   '1' , '  ', '   ',.........,'1000' )  or  id  in (   '1' , '  ', '   ',.........,'1000'  ) 

3、在 in 后接一个  查询语句

  select  *   from  table1  where   id  in  ( select id   from  table2)

4、使用 with  as 语法,把条件封装成一个表

  with  tmp  as  (select  id  from  table1)

   select  *  from  table2  where  id   in  (select  id from  tmp)    

参考:https://www.cnblogs.com/jhxxb/p/10830547.html

原文地址:https://www.cnblogs.com/wongzzh/p/15040109.html