Val1 is inspected on the open cursor. The declare is only reevaluted if
you close and reopen the cursor. The declare of the cursor isn't
executable code. It just tells the open what should be selected. That's
why you can technically put the declare someone else in your code so that
it doesn't clutter up what you are currently looking at.
--
Michael Schutte
Admin Professional
Try our new Farm-Fresh Wraps (Turkey Club, Chicken Salad and Chicken
Caesar) and Real Fruit Smoothies! Freshly prepared, wholesome and
delicious. For more information, visit www.bobevans.com
"Dennis Lovelady"
<iseries@lovelady
.com> To
Sent by: "'Midrange Systems Technical
midrange-l-bounce Discussion'"
s@xxxxxxxxxxxx <midrange-l@xxxxxxxxxxxx>
cc
04/27/2010 04:14 Subject
PM Imbedded SQL and dynamic variables
Please respond to
Midrange Systems
Technical
Discussion
<midrange-l@midra
nge.com>
We have a program on V5R3 with imbedded SQL that looks something like this:
EXEC SQL
SELECT MYVAL FROM MYTABLE
WHERE MYVAL BETWEEN :VAL1 and :VAL1 + 10 ;
It then proceeds to Fetch said value into VAL1.
(There's more to it but this is the area of focus.) Now, personally I
thought this would re-evaluate that BETWEEN value with each FETCH. But
that
doesn't appear to be happening; if VAL1 is 5 when the process starts, it
will not fetch rows where VAL1 >= 15 - even if Val1 represents a series of
contiguous numbers in that table. This latter is the effect the programmer
wanted, but I distrust it (and don't like its inclarity in any case). I
thought it should keep going since 16 is between (the current VAL1) and
(the
current VAL1+10).
Is this function operating by documented design? I've perused the SQL
manuals on this, but cannot seem to find a definitive description.
Thanks
Dennis E. Lovelady
AIM/Skype: delovelady MSN: fastcounter@xxxxxxxxxxxx
<
http://www.linkedin.com/in/dennislovelady>
www.linkedin.com/in/dennislovelady --
No time spent with a cat on your lap, can ever be considered 'wasted.'
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.