What is cursor (database)?

In database programs, cursors are database objects used to traverse the results of an SQL query. Each cursor has a name of its own. Developers can get record from cursor with SQL query one by one, and assign them to major variable for further process with host language.

Cursors point to a certain location within a record set and allow the operator to move forward (and sometimes backward, depending upon the cursor type) through the results one record at a time. Cursors are often criticized for their high overhead. Most procedural programming languages do not offer any mechanism for manipulating whole result-sets at once. In this scenario, the application must process rows in a result-set sequentially. Thus one can think of a database cursor as an iterator over the collection of rows in the result set.

Defining:

DECLARE cursor_name CURSOR
FOR SELECT ... FROM ...


: What is full text search?
: What is extern function?



Tags: cursors(database)   SQL query   database object   record  

Readers also visit these:

What is data, database (DB), DBMS and DBS?
Which license is best for me?
What is T-SQL (Transact-SQL)?
What is Database Integrity?
What is lock (database)?

Related Questions:

What is Database Integrity?
What is T-SQL (Transact-SQL)?
What is data, database (DB), DBMS and DBS?
What is role?
What is data backup and data recovery?