View Single Post

   
  #5 (permalink)  
Old 04-20-2008, 10:18 AM
scottishpoet
 
Posts: n/a
Default Re: Strange behaviour of FOREACH (INFORMIX-4GL Version 7.30.HC4P1)

you need to set isolation to commited read and put a begin work /
commit work around the foreach loop

SET ISOLATION

BEGIN WORK

FOREACH
EXECUTE UPDATE
END FOREACH

COMMIT WORK

If you don't have the begin and the commit then each update/insert will
be treated as a singleton transaction


Ravi wrote:
> Hi,
>
> Update on this problem posted by me:
>
> While reading from the table 'tab1', after some processing, we also
> update one timestamp field in the same table 'tab1'. So in short the
> program is something like this:
>
> FOREACH cur1
> ...
> <Do some processing here>
> ...
> EXECUTE upd_stmnt_for_tab1
> END FOREACH
>
> Regards,
> Ravi.
>
> Fernando Nunes wrote:
> > Ravi wrote:
> > > Hi All,
> > >
> > > We are facing a very strange issue while using FOREACH. The environment
> > > is as follows:
> > >
> > > HP-UX 11.11
> > > Informix 4GL 7.30.HC4P1
> > > Informix Dynamic Server Version 9.30.HC2
> > >
> > > 4GL program is opening a cursor on table 'tab1' with certain conditions
> > > in the where clause. When a FOREACH is applied to traverse through this
> > > cursor, it is not returning all the rows which satisfy the conditions.
> > > Due to this, the output of the program is not as expected. The
> > > behaviour is also not consistent as sometimes it gives 'x' number of
> > > records less and sometimes it gives 'y' number of records less.
> > >
> > > Please note:
> > > (1) The cursor declared is a plain cursor and not scroll cursor and
> > > without any WITH HOLD clause.
> > > (2) The isolation is set to dirty read before opening the cursor.
> > >
> > > Kindly let us know if there is any resolution to this issue. Is this
> > > some kind of bug in Informix 4GL tool for the version mentioned above.
> > >
> > > Thanks.
> > >
> > > Regards,
> > > Ravi.
> > >

> >
> >
> > And the contents of the table are not changing while your program runs?
> >
> > Regards.


Reply With Quote