Re: ESQL/C cursor looping
Posted in 1996
> allenj@ndr.com (Allen W. Jantzen) writes: ..snip... > Also: > If a row is added to a table while I am in the middle of cycling > through a cursor for that table, will I see the new row in my loop??? > > Or does the cursor only "see" rows that were present at the time of > the OPEN??? You shouldn't *expect* to see anything but what was available at the time of the OPEN. There are so many variables in how the cursor is created, and exactly when the data is actually read, there is no real way of knowing what you will get. (Examples are cursors with an order by that do not use an index - a temp table is created at the time of your open and all rows are read at that time. Or the engine may decide it can use an index (how do you know - you *don't*) - the rows may be read via the index as you do your fetches, and a change after your open may be included. Or a cursor with no order by and no index could be used - you may get the new row as you proceed through the fetches. Next time you open the same cursor an index may be used and it may behave differently. Or, or, or...) This is the kind of thing you should *not* be conserned with. If that row was added a little earlier (a millisecond or an hour) and that was before your opened your coursor it would have been included. A little later, and it was after your fetch and for sure it could not be included. There are other means you have to use to insure consistency and the reading of all data you need. Nils.Myklebust@ccmail.telemax.no NM Data AS, Postbox 9090, Gronland, 0133 Oslo, Norway My opinions are those of my company