Pro*C cursor problem

From: Jon Clendenen <jonmc2_at_nortel.com>
Date: Mon, 16 Nov 1998 15:10:02 -0600
Message-ID: <365094AA.50FA4F10_at_nortel.com>



[Quoted] [Quoted] I have a problem with a Pro*C application that I have upgraded from version 1 to version 2. The code has three nested cursors that are used to build a set of files for input to a different system. This code has worked for over a year on the old system, and has been migrated successfully in its compiled form to a new system. I have had to make a change in formatting of a date field to YYYY instead of YY, and need to recompile on the new system. I got a 'Fetch out of Sequence' error.  

The old code compiled on the old system will run on the new system properly, but when the same code is compiled successfully on the new system I get a 'Fetch Out of Sequence' error on the first cursor. Any ideas what is the problem here? I'm stumped.

The logic is:
declare cursor_A
open cursor_A
fetch cursor_A into variables_A
write variables_A to file
declare cursor_B
open Cursor_B
fetch cursor_B into variables_B
write variables_B to file
declare cursor_C
open Cursor_C
fetch cursor_C into variables_C
write variables_C to file
fetch cursor_C into variables_C
write variables_C to file
fetch cursor_C into variables_C
write variables_C to file (to end of cursor) close cursor_c
(go back to cursor_B
  fetch next row and write it
  go to cursor_C again
  repeat to end of cursor_B
  close cursor_B
 then fetch next row of cursor_A
 repeat process finally closing cursor_A and then updating the database to set flag for PROCESSED) Received on Mon Nov 16 1998 - 22:10:02 CET

Original text of this message