Thread: ecpg fetch

ecpg fetch

From
David Chays
Date:

We followed the syntax for cursors from a standard SQL book
but are getting a compilation error on the line               exec sql fetch in repcurs into :choices;

Thanks for your help,
-David, Dan

exec sql include sqlca;
..
exec sql begin declare section;         int  choices;
exec sql end declare section;
..
exec sql declare repcurs cursor for       select number from singer;
..
exec sql open repcurs;

exec sql whenever not found goto done;       
for (;;)       {               exec sql fetch in repcurs into :choices;               printf("Number %d \n", choices);
    }
 

done:   exec sql close repcurs;