Re: FWD/BACK/GOTO ? / ESQL
Posted in 1994
In article <CJt1un.94p@unix.portal.com> pkellner@shell.portal.com (Kellner Systems) writes:
>From: pkellner@shell.portal.com (Kellner Systems)
>Subject: FWD/BACK/GOTO ? / ESQL
>Date: Tue, 18 Jan 1994 03:03:55 GMT
>1. The Questions: I am converting a non-SQL ap to informix and
>have always thought that a critical "basic" function of a database
>is to allow a dialog type box that has the three buttons:
>Forward, Backwards and Goto. Of course this should work on a
>huge database. If I declare a scrolling cursor it is obvious
>how to do the forward and back but I'm confused on how to implement
>goto. That is if I do a select *, then fetches, I can't dive
>into the middle of a database, then take a step backward.
This is real easy to do: RTFM.
Fetch {Next, Prior, Absolute, Relative, First, Last, Current} INTO is the
syntax. The Goto can be implemented using the Absolute or the Relative forms.
For example:
FETCH ABSOLUTE 25 c_getem INTO record_var.*;
The above will fetch the 25th record in the list.
FETCH RELATIVE -25 c_getem INTO record_var.*;
The above will fetch [current - 25] record in the list.
There is no need for a separate list or buffer. The main issue would be
whether to run a select count(*) before the query for error handling purposes
or whether to handle it using SQLCA.SQLCODE.
>2. More Question: In ESQL, how can I access the hidden variable
>rowid? Or any other integer for that matter. Hmmm.
This also is simple:
SELECT rowid, *
INTO z_rowid, r_var.*
FROM table;