base.SqlHandle.fetchPrevious
Fetches the previous row in a scrollable SQL result set.
Syntax
fetchPrevious()
Usage
Call the fetchPrevious()
method to fetch to the previous row in a scrollable SQL result set.
The SQL statement must have been opened with an openScrollCursor()
call.
After performing the fetch call, you can query for column information
with the getResultCount()
, getResultName(index)
, getResultType(index)
and getResultValue(index)
methods.
If no row is found (end of result set), sqlca.sqlcode is set to 100 (NOTFOUND).
If the result set is empty, or if the current row is already the first row, sqlca.sqlcode is set to 100 (NOTFOUND).
As with standard Genero SQL instructions, SQL errors can be trapped
with WHENEVER ERROR
or TRY / CATCH
blocks and by testing
sqlca.sqlcode
.
Example
DEFINE sh base.SqlHandle
...
CALL sh.fetchPrevious()
For a complete example, see Example 4: SqlHandle with scroll cursor.