Home » Developer & Programmer » Precompilers, OCI & OCCI » Using 'Host Arrays' in the 'WHERE' clause (Oracle 10g, Pro*C/C++: Release
icon5.gif  Using 'Host Arrays' in the 'WHERE' clause [message #450925] Sat, 10 April 2010 14:06
Messages: 1
Registered: April 2010
Junior Member

I am new to Pro*C.

I have a list of IDs in an array corresponding to which I want to get the NAME values from the database table. One way is that I fire a SELECT query seperately for each ID value. I have tried doing this and it work fine. The second way (and the more efficient one) is that I pass all these ID values in the array to the WHERE clause of my SELECT statement. So I am trying to do that and facing some problems with it.

The problem is that, I only get the values corresponding to the first ID in my ID array. Although there are rows in my table corresponding to the other IDs, but they are not fetched. Only the row corresponding to the first ID in the ID array gets fetched.

So, lets say that my array of IDs has the following values:-
1, 2, 3
When I try to fetch the rows from the table corresponding to these ID values, only the row corresponding to ID = 1 is returned.

Following is the way I precompile and compile this stuff:-
1) proc code=CPP example.cpp
2) g++ -I /oraclient/Sol10_64_x86/10.2/precomp/public -L /oraclient/Sol10_64_x86/10.2/lib example.c -lclntsh -lsql10

I am not setting amy PROC options other than code=CPP. Could there be an issue with the PROC options that I need to set.

Could not really get much help from google on this and the Oracle's Pro*C programmer's guide did not have any example showing this either. I hope I do not need to use the dynamic method 4 for this.

Have spent quite a bit of time trying to resolve it myself, but have not been able to figure out much. So I want to try getting some help now.

The code that I am using is attached with some small modifications. Please feel free to take a look Smile
  • Attachment: example.txt
    (Size: 1.48KB, Downloaded 917 times)
Previous Topic: Link error for ProC files (merged)
Next Topic: PROC compilation
Goto Forum:

Current Time: Tue Mar 28 02:52:53 CDT 2023