Hi Claudine, This caught my attention also since cursors as usually associated with loops. But was a little stumped when there was no where clause with the update.
Would Update wsOrder Set CustName = Rolodex.co_Name + from Rolodex, WsOrder + Whe Rolodex.co_Code = wsOrder.CustCode do the same thing as the first block? Assuming I've got the syntax right (I always struggle a bit with these) and assuming Update allows referencing the same table as target and source... Ben Petersen On 31 Jan 2003, at 11:36, Claudine Robbins wrote: > Hi Albert, > I don't have a loop structure because I'm simply executing both > commands. And I do have the drop cursor lines at the beginning and > the end of my file. Are you saying I should have a loop anyway? > ~Claudine > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Albert > Berry Sent: Friday, January 31, 2003 8:52 AM To: RBASE-L Mailing List > Subject: [RBASE-L] - RE: OPEN cursor RESET > > Claudine, I don't see your loop structure, but this is the recommended > structure. I have found that deviating from it can cause me problems. > > SET VAR ... -- declare them ALL here > DROP CURSOR c1 -- safety touches > DROP CURSOR c2 -- > DECLARE c1 CURSOR FOR .... -- outer cursor > DECLARE c2 CURSOR FOR ... -- inner cursor > OPEN c1 RESET -- I always use reset even when I don't need it > FETCH c1 INTO ... > WHILE SQLCODE <> 100 THEN > OPEN c2 RESET > FETCH c2 INTO > -- code goes here > FETCH c1 INTO ... > ENDWHILE > DROP CURSOR c2 > DROP CURSOR c1 > > "Claudine Robbins" <[EMAIL PROTECTED]> wrote: > > >FYI: Just a heads-up. The following code (without the RESET after > >OPEN cursor2 and cursor3) worked flawlessly (for at least 5 years) > >until yesterday. �The first one would correctly retrieve the name, > >the second one wouldn't. �After I added RESET, everything is working > >right again. ~Claudine :) > > > >

