FETCH
The FETCH command is provided in OdxSQL to retrieve selected rows. By
default, a SELECT processed in OdxSQL will automatically retrieve the
selected rows. However, if AUTOFETCH is turned OFF, a SELECT or a QUALIFY
followed by a SELECT must be followed by a FETCH to retrieve the qualified
rows.
- FETCH ALL will retrieve all qualified rows.
- FETCH n will retrieve n rows. In this case, FETCH can be called repeatedly
until all rows have been retrieved.
- FETCH by itself, that is without n or ALL, will fetch 1 row at a time.
In the last two cases, FETCH can be called repeatedly until all rows
have been retrieved.
Syntax
FETCH [<n | ALL>] [ON [CURSOR] cursor] [WITH options]
FETCH
Required.
n | ALL
Optional.
n is an integer representing the number of rows to fetch. In this case,
FETCH can be called repeatedly until all rows have been retrieved.
ALL will retrieve all qualified rows.
If n and ALL are omitted, rows will be retrieved one at a time. FETCH
can be called repeatedly until all rows have been retrieved.
ON CURSOR cursor
Optional. Specify the cursor on which to perform the fetch. cursor is
the integer cursor number generated when the cursor was opened. The CURSOR
keyword is optional. The ON keyword is required if the cursor is being
specified.
WITH options
Optional. A comma separated list of options to apply to this command.
Options
TIMEOUT
Example
>set autofetch off
>qualify customers where state='co'
38 CUSTOMERS records qualify
>qualify customers where company='and systems'
3 CUSTOMERS records qualify
>select company, contact from customers with 'odxid'
Select statement processed
>fetch all
COMPANY
CONTACT
Dynamic Information Systems Corp
Mark S. Trasko
Summit Information Systems
Mark Polando
Mini-Computer Systems
Phil Norisez
3 rows returned
>
Top
|