Buddy:  Thanks that's what I was thinking of doing (although I still might 
consider
Mike's idea of keeping the cursor itself).   Rather than deleting rows from 
the 
temp table, I would probably update a flag column instead.  But that's good 
code...

Karen


In a message dated 9/11/2012 6:23:54 PM Central Daylight Time, 
[email protected] writes: 
> Karen
> 
>  I would take this cursor you are trying to eliminate is the outer one.
> 
>   I would create a temporary table and load all of the values from the 
> autonumber field that meets your where clause.
> 
>   Your code would replace the outer curse with something like this (Notice 
> commented out the while loop)
> 
> Buddy
> 
>  
> 
>     SET VAR vMyAutoNumber INTEGER = 0
>     SET VAR vRows INTEGER = 0
> 
>  --While SQLCODE <>100 THEN
> 
>     LABEL StartWhileC1Here
> 
>      SET VAR vMyAutoNumber = 0
>      SELECT autonumerField INTO vMyAutoNumber INDICATOR iv1 FROM tempTable 
> WHERE LIMIT = 1
>      IF vMyAutoNumber = 0 THEN
>        GOTO Done
>      ENDIF
> 
>       Run your other code here 
> 
>        Then any place you want to jump to the end just 
> 
> --Make sure if you break out of anywhere loops make sure to close any open 
> cursor.
> 
>  
> 
>       GOTO EndWHileC1Here 
> 
>         
>     LABEL EndWhileC1Here
> 
>     DEL ROW FROM TempTable WHERE AutonumberFiled = .vMyAutoNumber 
> 
>     SELECT COUNT(*) FROM INTO vRows INDIC IV FROM TempTable WHERE COUNT = 
> 1
> 
>     IF vRows <>0 THEN
> 
>       GOTO StartWhileC1Here
> 
>     ELSE
> 
>     GOTO Done
> 
>     ENDIF
> 
> --ENDWHILE
> 
>  
> 
>    LABEL Done
> 
> 
> 

Reply via email to