• Subject: Re: SQL Cursor Questions
  • From: Pete Hall <pbhall@xxxxxxxxxx>
  • Date: Thu, 18 Nov 1999 21:05:25 -0600

At 21:06 11/17/1999 , Nelson C. Smith wrote:
>interactively, it uses the access path of the logical.  The only difference
>is the cursor is not used in the interactive version.  Is this normal
>operation for cursors or am I doing something wrong?

If you don't specify ORDER BY, SQL will retrieve the data in whatever it 
perceives to be the cheapest way. Interactively, if I have this straight 
now, it will go for fastest display of the initial screen of data. In batch 
it will try for fastest completion of job. It sometimes makes some pretty 
arbitrary decisions, but that's the general idea.

>What I really want to do is set the cursor to a
>particular record, but then be able to fetch records without regard to any
>where clause.  In other words, I want to do a SETLL with a key, and then
>READ or READP without a key.  Is there any way to do this? (besides using
>RPG, of course ;-)

Welllll, you could probably do a select and retrieve the relative record 
number (RRN()) where you want to start, then use FETCH RELATIVE to position 
your cursor. From there you could read in either direction with FETCH 
PRIOR/NEXT. Pretty cool stuff SQL, but it's really oriented to record sets, 
not traditional file I/O.
Pete Hall
pbhall@execpc.com
http://www.execpc.com/~pbhall
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].