Hello I've been trying to use a cursor with embedded sql in c but I can't seem to get it to stop reading the last row in my table. The table is called publication with two attributes pubid and title. I just want my cursor to iterate through and display the pubid. This is what i have:
EXEC SQL DECLARE C1 CURSOR FOR SELECT pubid FROM publication;
EXEC SQL OPEN C1;
while(SQLCODE !=100){
EXEC SQL FETCH C1 INTO :pubid; //a host variable that was declared earlier
cout<<pubid<<endl;
}
When I run, it displays all the rows and infinitely repeats displaying the last row. I tried displaying the SQLCODE as well and it remains 0, so I'm not sure why the cursor doesn't move past the last row