Re: Problems when opening cursor for prepared statement twice
Posted in 1994
Joerg_Spilker@daolin.fido.de (Joerg Spilker) writes:
>Hi all,
>i've the following problem: I declared a cursor for a prepared select (sums
>about two field, divided into groups over 4 fields).
>This cursor is used in function in the following way:
>OPEN q_cursor USING a,b,c,d,e,f,g
>FETCH q_cursor INTO x,y,z
>WHILE STATUS <> NOTFOUND
> calculate something
> FETCH q_cursor INTO x,y,z
>END WHILE
>CLOSE q_cursor
>The second call of the function gives the following result when opening the
>cursor (all calls are running within one transaction):
>-270: Cannot position within temporary table
>-101: File is not open
>What's happening ??
>Greetings, Joerg
I do not know what causes the problem, but I run into almost
exactly the same situation. I ended up freeing the first prepared statement,
and creating the second one from scratch. I worked but it resulted in
duplication of code. I would be interested in reading about other solutions
to this problem. By the way, the second statement must be prepared using
a different string (even if you free the first one).
--
Gabriel Beccar-Varela Internet : gabriel@netcom.com
Voice : (510) 654-2030
Fax : (510) 654-3182