| How specify more than 1000 values in IN operator [message #200750] |
Wed, 01 November 2006 03:42  |
sreehari
Messages: 101 Registered: May 2006
|
Senior Member |
|
|
Hi all
How to specify more than 1000 values in IN operator in SELECT statement,
eg:select * from emp where empid in (3,4,66,74,...upto more than 1000 values)
i am getting
ORA-01795: maximum number of expressions in a list is 1000
is there any alternative in SQL for above query.
Thanks
|
|
|
|
| Re: How specify more than 1000 values in IN operator [message #200752 is a reply to message #200750] |
Wed, 01 November 2006 03:47   |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
If you can get the values into a temporary table, you can use a sub select:select *
from emp
where empid in (SELECT id from global_temporary_table) If you can get the values into a userdefined table type (needs to be defined in SQL, not in a package, you can doSELECT *
from emp
where empid in (SELECT * from table(user_table)) If you can't do any of these, you can use an ORSELECT *
from emp
where (empid in (1,2,3....1000)
OR empid in (1001,1002....))
|
|
|
|
|
|
|
|
|
|
|
|
|
|