ORA-01795: maximum number of expressions in a list is 1000
Load Test的时候发现这么如下这个错误....
ORA-01795: maximum number of expressions in a list is 1000
导致这个问题的原因是因为SQL语句中用到了IN字句,结果IN中的元素个数超过了1000导致了这个错误。如下所示...

declare
l_cnt pls_integer;
l_list varchar2(32767);
begin
select listagg(level, ',') WITHIN group(order by level)
into l_list
from dual connect by level<=1000; execute immediate 'select count(*) from user_objects where object_id in (' || l_list || ')'
into l_cnt;
end;
/

这个例子中in中元素个数是1000, 可以正常运行,但是下面这个例子就会报错,因为IN中的元素个数超过了1000...

declare
l_cnt pls_integer;
l_list varchar2(32767);
begin
select listagg(level, ',') WITHIN group(order by level)
into l_list
from dual connect by level<=1001; execute immediate 'select count(*) from user_objects where object_id in (' || l_list || ')'
into l_cnt;
end;
/

解决这个问题的方法是在程序中将一个IN改成多个IN, 或者把IN List 改成一个SELECT语句,把IN List中的元素放到一个Nested Table中。
ORA-01795: maximum number of expressions in a list is 1000的更多相关文章
- 错误:maximum number of expressions in a list is 1000
某一日发现这么如下这么一个错误 --> maximum number of expressions in a list is 1000 原因:因为SQL语句中用到了IN字句,而IN中的元素个数 ...
- iOS---The maximum number of apps for free development profiles has been reached.
真机调试免费App ID出现的问题The maximum number of apps for free development profiles has been reached.免费应用程序调试最 ...
- [LeetCode] Third Maximum Number 第三大的数
Given a non-empty array of integers, return the third maximum number in this array. If it does not e ...
- [LeetCode] Create Maximum Number 创建最大数
Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum numb ...
- LeetCode 414 Third Maximum Number
Problem: Given a non-empty array of integers, return the third maximum number in this array. If it d ...
- Failed to connect to database. Maximum number of conections to instance exceeded
我们大体都知道ArcSDE的连接数有 48 的限制,很多人也知道这个参数可以修改,并且每种操作系统能支持的最大连接数是不同的. 如果应用报错:超出系统最大连接数 该如何处理? 两种解决办法: 第一,首 ...
- POJ2699 The Maximum Number of Strong Kings
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2102 Accepted: 975 Description A tour ...
- [LintCode] Create Maximum Number 创建最大数
Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum numb ...
- tomcat 大并发报错 Maximum number of threads (200) created for connector with address null and port 8080
1.INFO: Maximum number of threads (200) created for connector with address null and port 8091 说明:最大线 ...
随机推荐
- Log4j(一):Log4j将日志信息写入数据库
前言 为了监听一些数据的采集等功能,需要随时监听设备的状态,所以需要运行的时候将日志打入到数据库中. 正文 第一步: 首先是jar包,由于我使用的是springboot,所以,在springboot- ...
- 《DSP using MATLAB》Problem 2.2
1.代码: %% ------------------------------------------------------------------------ %% Output Info abo ...
- oracle Union 中 ORA-12704:字符集不匹配问题的解决 .
在使用Union all连接时,若A集合中某列为nvarchar2或nvarchar类型,而B集合中无此列,用‘ ’ 来代替是会报字符集不匹配,解决方法有两种,见下面的示例 例: select '中国 ...
- Mybatis新增mysql时中文乱码
Mybatis新增mysql时中文乱码 1.设置数据库连接的编码(jdbc.properties) jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:my ...
- application项目获取bean
对于web项目,编程方式获取bean如下: WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext(); C ...
- spark on es 多索引查询
核心接口 trait SparkOnEsService { val conf = new SparkConf // conf.setMaster("local[10]") val ...
- 【python】 使用 setuptools
不会安装python的egg文件,在网上搜索了一下,被“蟒蛇蛋”这个词雷到了,记录下. 随着对python的逐渐使用,发现一些python组件是用一个包管理器发布的,今天搞了快一个小时,终于搞定了,这 ...
- linux Posix 信号量 一
信号量是一种用于提供不同进程间或一个给定进程的不同线程间同步手段的原语. linux提供两种信号量,“内核信号量”和“用户态进程信号量”,“用户态信号量”又分为“Posix”,“System V”信号 ...
- Makefile中进行宏定义-***
实际上是gcc命令支持-D宏定义,相当于C中的全局#define: gcc -D name gcc -D name=definition Makefile中可以定义变量(和宏很像),但是是给make解 ...
- HDU 3179 二叉搜索树(树的建立)
二叉搜索树 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...