Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ORA-00913: too many values - multiple IN clauses, each with 990 elements each

Hello,
Was attempting to query data from a table for 145000 values . Created a SELECT statement that used multiple IN clauses, where each IN clause had 990 values in it . Kept getting ORA-00913 despite ensuring each IN clause had < 1000 values. After a lot of trials noticed that the error starts after including the 65536'th value.
Wanted to know if anyone is aware of the reason.
Steps to recreate :
create table test_numbers (a number);
insert into test_numbers
select level from dual connect by level <=145513;
commit;
Now try to select data from the table :
select * from table where (column in (1,2,3....) or column in (991,992,993...)..)
Works fine so long as the last IN clause has value upto 65535.
Get ORA-00913 when the last IN clause has value 65536 and beyond.
ORA-00913-script.zip (72.31 KB)
ORA-00913_error.png (121.2 KB)Database version : 19.11.0.0.0
SQL Developer version: 21.2.0.187
PS: Just curious why it raised ORA-00913.

Comments
Post Details
Added on Aug 11 2021
2 comments
952 views