Re: Need advice on NewEra
Posted in 1995
Topics: Error Codes & Troubleshooting
cat@tecsys.com (Catalin Badea) wrote
>I have done similar tests, but have not encountered the alleged problem.
>Your solution seems overly complicated for something that is
straightforward:
>
>declare C1 cursor for
> select * from T1 where A=X
> order by A,B,C # optional order by>foreach C1 into T1_record
>
> ... do stuff ...
>
> select * from other_table where ...>
> if sqlca.sqlcode != notfound then
>
> ... specific stuff ...
>
> end if
>
>end foreach
>
>I wonder if you could post the code that gave you problems and
>include some sample data.
>
>Catalin.
>
>P.S. I'd stay away from GOTO statements (in any language)
>
Catalin,
The code you describe, if it gets a notfound on other_table will fail at
the beginning of the next loop trying to do a fetch on C1 and C1 was
closed by the notfound condition. I got a solution from
mstrothr@informix.com (Michael Strother) who told me to include the "WITH
HOLD" clause in my cursor declaration. That fixed it.
Thanks for you interest.
--------------------------------------------------------------------------
Ken Denny, Insight Industries Inc (I cubed)
All opinions expressed are ... (the usual bit)
No cute graphic stuff because some people (myself included) use fonts
other than Courier which makes the cute graphic stuff not so cute
--------------------------------------------------------------------------
-