PRO C Dynamique select with multiple rows [message #123921] |
Wed, 15 June 2005 10:02 |
gorgorbhey
Messages: 1 Registered: June 2005
|
Junior Member |
|
|
hello
i ve a problem with PRO C (i m a novice)
i d like to do a select which may have multiple row
i read a file which give me a number
i put this number into a variable numof
...
while (fgets (bufe,sizeof(bufe), ptlec))
{
/* here i ve C code which egt the number in the line */
EXEC SQL DECLARE C1 CURSOR FOR
SELECT NUM_OF,
NUM_LIGN,
to_char(DAT_SORT_PREV,'DD-MON-YYYY'),
CODE_FINI_SPEC
FROM OF_LIGN
WHERE NUM_OF=:numof;
EXEC SQL EXECUTE C1 USING :numof;
EXEC SQL OPEN C1;
EXEC SQL WHENEVER NOT FOUND CONTINUE;
EXEC SQL FETCH C1 INTO :numof, :numligne, :dat_sort_prev, :code_fs;
while (sqlca.sqlcode != 1403)
{
fprintf(ptlog,"of : %s ligne : %d Date : %s FS : %s\n",
numof.arr, numligne, dat_sort_prev.arr, code_fs.arr);
EXEC SQL FETCH C1 INTO :numof, :numligne, :dat_sort_prev, :code_fs;
compteur++;
}
fprintf(ptlog,"il y a %d lignes selectionnees\n",compteur);
EXEC SQL CLOSE C1;
EXEC SQL WHENEVER SQLERROR CONTINUE;
EXEC SQL COMMIT WORK RELEASE;
}
it works ok for the first line
but for the second the fetch always send me the last row of the first select
how can i do that ?*
thanks
|
|
|
|