今天用TOAD执行SQL遇见一个ORA-01795: maximum number of expressions in a list is 1000 错误,
才知道In-list有1000个元素的限制;
经查:
可以使用array bind或者temporary table解决,而且还能绑定变量。
[Limit and conversion very long IN list : WHERE x IN ( ,,, ...) ]
declare
xx dbms_sql.varchar2s;
l_cursor integer default dbms_sql.open_cursor;
begin
xx(1):='xxxxxxx';
xx(2):='xxxxx';
....
.....
....
dbms_sql.parse(l_cursor,xx,dbms_sql.native);
dbms_sql.close_cursor(l_cursor);
end;
/