Re: OCI and binding arrays

From: Ken Wallis <kenws_at_empower.aust.com>
Date: Sat, 23 Nov 2002 23:18:03 GMT
Message-ID: <3de00ca7$1_at_news.comindico.com.au>


Nicolay Aslaksen <nas_at_ementor.no> wrote:

> I am coding a C++ application on a windows 2000 platform (it will
> later be running on Linux and AIX).
>
> I would like to execute a select statement where the WHERE-part is an
> array (of id's):
>
> something like this in C++:
> ---------------------------
> long buffSize = 4;
> long *IDlist = new long[buffSize];
>
> IDlist[0] = 982374;
> IDlist[1] = 324443;
> IDlist[2] = 989485;
> IDlist[3] = 430904;
>
> sql = "SELECT ref(x) FROM persons p WHERE p.id IN :id";
>
> Prepare (sql);
> OCIBindByPos(stmtp, bindp, errhp, 1, (dvoid*)&IDList, buffSize,
> (ub2)SQLT_INT, (dvoid *)0, (ub2 *)0, (ub2 *)0, (ub4)0, (ub4 *)0,
> (ub4)OCI_DEFAULT);
>
> ----------------------------
>
> I have seen several questions about similar problems/whishes, but I
> have not found any answers to the problem.
> Is there anyone who has a solution to this problem?

Look up OCIDefineArrayofStruct() and OCIBindArrayofStruct() in the manuals

HTH, Ken Received on Sun Nov 24 2002 - 00:18:03 CET

Original text of this message