Mike:   You will never convince me that your way is better!!   ;-)

I suppose there is a "double test" -- it does have to figure out each
loop if 1 is still = 1 ...   But the best advantage is that there is only
ONE fetch.   Come on...  how many times have you added a column
to the declare statement and changed one fetch but forgot to change
the other fetch?????

Karen

 
> If I were traversing a large dataset, I would rather use two fetches with 
> 
> only one test for TRUE per loop instead of the obvious double test in this 
> 
> format.  So as a matter of course, large dataset or small, I stick with 
> the 
> double fetch for standardization.
> 
> 
> ----- Original Message ----- 
> From: "Dennis McGrath" <[email protected]>
> To: "RBASE-L Mailing List" <[email protected]>
> Sent: Friday, June 12, 2009 10:06 AM
> Subject: [RBASE-L] - Re: Cursor operation continues after end of data
> 
> 
> This is my personal preference too.
> There is only one fetch to maintain, and the program flow is totally 
> unambiguous.
> Dennis McGrath
> 
> ________________________________
> From: [email protected] [mailto:[email protected]] On Behalf Of 
> [email protected]
> Sent: Thursday, June 11, 2009 4:56 PM
> To: RBASE-L Mailing List
> Subject: [RBASE-L] - Re: Cursor operation continues after end of data
> 
> Randy:   Marc is right.   It is evaluating true because it is looking at 
> the 
> LAST command that's before your while loop.   FWIW, I never use the "WHILE 
> 
> SQLCODE <>100 THEN" structure because of that.  I just don't trust to know 
> 
> what command it is evaluating.  I always do this:
> 
> DECLARE c1 CURSOR FOR SELECT .....
> OPEN c1
> WHILE 1 = 1 THEN
>   FETCH c1 INTO vars....
>   IF SQLCODE = 100 THEN
>       BREAK
>   ENDIF
> ENDWHILE
> 

Reply via email to