Cursor Class
Contains methods to fetch records and to get the number of cursor rows returned from a SOQL query.
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.
The following are methods for Cursor.
-
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 100Cursor.fetch()calls per transaction. -
Gets the number of rows returned in an Apex cursor from a
Cursor.fetch(position, count)operation.
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.
public static List<SObject> fetch(Integer position, Integer count)
- position: Type: Integer The offset position from which records are fetched.
- count: Type: Integer The number of sObjects to fetch from the cursor, up to a maximum of 2,000.
The list of sObjects from the SOQL query, starting from the specified position.
Gets the number of rows returned in an Apex cursor from a Cursor.fetch(position, count) operation.
public static Integer getNumRecords()
Type: Integer