Re: How to use an array in the IN clause?

From: AnaCDent <anacedent_at_hotmail.com>
Date: Fri, 19 Mar 2004 17:58:28 -0800
Message-ID: <9zN6c.11836$Bg.6113_at_fed1read03>


Daniel Kunz wrote:

> I'm using Oracle 9.2 and I would like to use an array/collection in
> the IN clause of a SELECT statement. My application is programmed in C
> and I'm using OCI. The select statement I'm using looks like this:
> "SELECT value FROM numbertab WHERE zvalue IN :1"
> The number table is rather huge (it contains several millions of
> rows). The ':1' parameter corresponds to a set containing about 300
> numbers (the numbers of this input set are calculated in realtime).
> Because issuing 300 select statements separately would cost lots of
> performance, I came up with the idea of using an array/collection as
> input for the select statement.
> Unfortunately, I couldn't find any OCI documentation how to do it. Is
> it possible at all? I guess that OCIBindArrayOfStruct() cannot be
> used, because it doesn't allow to specify the size of the array.
>
> I am totally stumped - any ideas out there??
>
> Thanks very much for any responses.
>
> - Danny.
 

 > Is it possible at all?

Not as far as I know; at least how you want to do it. You could create the necessary actual SQL SELECT statement and the EXECUTE IMMEDIATE this statement. Received on Sat Mar 20 2004 - 02:58:28 CET

Original text of this message