Cursor Class
Contains methods to fetch records and to get the number of cursor rows returned from a
SOQL query.
Namespace
Usage
A cursor is created when a SOQL query is executed on a Database.getCursor() or a Database.getCursorWithBinds() call. When the SOQL query is invoked, the corresponding rows are returned from the cursor. The maximum number of rows per cursor is 50 million, regardless of the operation being synchronous or asynchronous.
Example
Cursor Methods
The following are methods for Cursor.
fetch(position, count)
Fetches cursor rows that correspond to the offset position and the specified record
count. The maximum number of rows per cursor is 50 million, regardless of whether the operation
is synchronous or asynchronous. Calling the Cursor.fetch()
method counts against the SOQL query limit, and the rows fetched count against the SOQL query
row limit. You can make a maximum of 100 Cursor.fetch() calls
per transaction.
Signature
public static List<SObject> fetch(Integer position, Integer count)
Parameters
getNumRecords()
Gets the number of rows returned in an Apex cursor from a Cursor.fetch(position, count) operation.
Signature
public static Integer getNumRecords()
Return Value
Type: Integer