base.SqlHandle.fetch
Fetches a new row from the SQL result set.
Syntax
fetch()
Usage
Call the fetch()
method to fetch a new row from the SQL result set.
When using a dynamic scroll
cursor, the fetch()
method can be used to fetch to the next row.
The SQL statement must have been opened with an open()
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).
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.fetch()
For a complete example, see Example 2: SqlHandle with result set SQL.