While the temporary table is a global temporary table (i.e. visible only for the session), this is the recommended way to do things (and I would go along this route for something more than a dozen arguments, not to mention thousands).
I am wondering where / how you are building a list of 1000 arguments. If this is a semi-permanent grouping (for example, all employees based in a certain place), then this grouping should be in the database and joining is done there. Databases are designed and built to make connections very quickly. Much faster than pulling a bunch of identifiers back to the middle tier and then sending them back to the database.
select * from orders where user_id in (select user_id from users where location = :loc)
Gary myers
source share