/*-------------------------------------------------------------------- * Pro*C program - Using host array in WHERE clause *-------------------------------------------------------------------- */ #include #include void sqlerror(); EXEC SQL BEGIN DECLARE SECTION; char *connstr = "username/password@database"; char str[30]; short ind; struct MyStruct { int id; char name[30]; } ; struct MyStruct structVar; struct MyStruct structArray[3]; int idArray[3]; EXEC SQL END DECLARE SECTION; int main() { int i, recordCount; printf("Connecting to Oracle\n"); EXEC SQL WHENEVER SQLERROR DO sqlerror(); EXEC SQL WHENEVER SQLWARNING CONTINUE; EXEC SQL CONNECT :connstr; idArray[0] = 4; idArray[1] = 2; idArray[2] = 1; EXEC SQL PREPARE my_statement FROM SELECT AREA_ID, NM FROM MY_TABLE_NAME WHERE AREA_ID = :y; EXEC SQL DECLARE my_cursor CURSOR FOR my_statement; EXEC SQL OPEN my_cursor USING :idArray; EXEC SQL WHENEVER NOT FOUND DO break; while(true) { EXEC SQL FETCH my_cursor INTO :structArray; recordCount = sqlca.sqlerrd[2]; printf("RECORD COUNT: %d\n", recordCount); for(i=0; i