SQLFetchScroll
SQLFetchScroll#
SQLFetchScroll() fetches the specified rowset of data from the result set and returns data for all bound columns. Rowsets can be specified at an absolute or relative position.
Syntax#
SQLRETURN SQLFetchScroll(SQLHSTMT stmt,
SQLSMALLINT fOrient,
SQLINTEGER fOffset)
Arguments#
Data Type | Argument | In/Output | Description |
---|---|---|---|
SQLHSTMT | stmt | Input | Statement handle |
SQLSMALLINT | fOrient | Input | Type of fetch, This argument determines scroll direction. SQL_FETCH_NEXT SQL_FETCH_PRIOR SQL_FETCH_FIRST SQL_FETCH_LAST SQL_FETCH_ABSOLUTE SQL_FETCH_RELATIVE SQL_FETCH_BOOKMARK The above values determine the scroll direction. |
SQLINTEGER | fOffset | Input | Number rows to fetch |
Return Values#
SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_INVALID_HANDLE
SQL_ERROR
SQL_NO_DATA
Description#
This function returns the desired rowset from the result set. This rowset can be specified by the absolute or relative position, or by bookmark, however, SQL_FETCH_NEXT is only valid if the cursor attribute is SQL_CURSOR_FORWARD_ONLY.
The location of the cursor can be specified as follows:
SQL_FETCH_NEXT
Return the next rowset. This is equivalent to calling SQLFetch(). SQLFetchScroll() ignores the value of FetchOffset.
SQL_FETCH_PRIOR
Return the prior rowset. SQLFetchScroll() ignores the value of FetchOffset.
SQL_FETCH_RELATIVE
Return the rowset FetchOffset from the start of the current rowset.
SQL_FETCH_ABSOLUTE
Return the rowset starting at row FetchOffset.
SQL_FETCH_FIRST
Return the first rowset in the result set. SQLFetchScroll() ignores the value of FetchOffset.
SQL_FETCH_LAST
Return the last complete rowset in the result set. SQLFetchScroll() ignores the value of FetchOffset.
SQL_FETCH_BOOKMARK
Returns the rowset by scrolling the cursor as far as from the bookmark, specified for the SQL_ATTR_FETCH_BOOKMARK_PTR statement attribute, to fOffset.
Diagnosis#
SQLSTATE | Description | Comments |
---|---|---|
01004 | String data, right truncated | The size of the value to be returned is greater than the size of the given buffer |
08S01 | Communication | Communication channel failure before the function processing is completed between the Altibase CLI driver and the database |
HY000 | General error |
Error Handling#
The handling of errors and warnings can be applied to each row individually or to all functions.
If any warning applies to all functions, SQLFetchScroll() returns SQL_SUCCESS_WITH_INFO and the appropriate SQLSTATE. Warning status records that apply to the function are returned before the status records are individually applied to the rows.
Related Function#
SQLFetch
Example#
SQLFetchScroll(stmt , SQL_FETCH_RELATIVE, 10);