A cursor is actually a mechanism for fetching one record at a time from a result set that contains multiple data records.
The cursor acts as a pointer. Although the cursor can traverse all the rows in the result, it only points to one row at a time.
In a nutshell, a SQL cursor is a temporary database object, that is, a copy of a data row stored in a database table, or a pointer to a data row stored in the database. Cursors provide methods for manipulating data in a table on a row-by-row basis.
A common use of cursors is to save query results for later use. The result set of the cursor is generated by the SELECT statement. If the process needs to reuse a recordset, creating a cursor and using it several times is much faster than repeatedly querying the database.
Most programming languages can use cursors to retrieve data in an SQL database. Embedding cursors in a program is the same as embedding SQL statements in a program.
In a nutshell, a SQL cursor is a temporary database object, that is, a copy of a data row stored in a database table, or a pointer to a data row stored in the database. Cursors provide methods for manipulating data in a table on a row-by-row basis.
A common use of cursors is to save query results for later use. The result set of the cursor is generated by the SELECT statement. If the process needs to reuse a recordset, creating a cursor and using it several times is much faster than repeatedly querying the database.
Most programming languages can use cursors to retrieve data in an SQL database. Embedding cursors in a program is the same as embedding SQL statements in a program.