Re: Prepared SQL Statements and Performance
Posted in 1996
Sally Woolrich <Sally@excelsis.demon.co.uk> wrote: >I have often seen code where cursors are declared within loops so >the same cursor is declared each time the loop executes. This certainly >is *highly* inefficient as it should almost *always* be possible to >declare the cursor (once!) before the loop. The only case I can think >of is where the cursor which is declared depends on the data which is >present in the loop - note, not that the same cursor uses different >data in each iteration! >DECLARE cursor1 >FOREACH cursor1... > DECLARE cursor2 > FOREACH cursor2 > END FOREACH >END FOREACH # horrid!!! >DECLARE cursor1 >DECLARE cursor2 >FOREACH cursor1 > FOREACH cursor2 > END FOREACH >END FOREACH # better I was under the impression that Declare statements were compile time statements that set up data area for cursor retrieval. Hence it makes no difference where the Declare gets put. The Declare statement does not set the status variable (at least not up to 4.10). Can anyone from Informix enlighten us ? One of my initial gripes when I first started using Informix was the lack of documentation on which statements are compile time only (eg WHENEVER ERROR), which statements alter the STATUS variable, and how the various display statements affect the screen. Cheers, Brent Jackson. brent@hypercom.co.nz Phone : 64-9-3603593 Fax : 64-9-3602840