Joke Collection Website - Bulletin headlines - What is a cursor in Sql?

What is a cursor in Sql?

In a database, cursors provide a flexible way to manipulate data retrieved from tables. In essence, a cursor is actually a mechanism that can extract one record at a time from a result set containing multiple data records.

Cursors are always associated with SQL select statements, because cursors consist of result sets (which can be zero, one or more records retrieved by related select statements) and cursor positions in the result sets that point to specific records.

Cursor operations in the database will affect the entire rowset. By who? Choice? The rowset returned by the statement includes all the rows that satisfy the statement. Where is it? Conditional line in clause. A complete set of rows returned by a statement is called a result set.

Applications, especially interactive online applications, do not always effectively treat the entire result set as a unit. These applications need a mechanism to process one row or some rows at a time. Cursors are result set extensions that provide this mechanism.

Extended data:

The cursor extends the result processing in the following ways:?

1. Allows navigation to a specific row in the result set.

2. Retrieve one or more rows from the current position of the result set.

3. The row at the current position in the result set supports data modification.

4. Provide different levels of visibility support for the changes made by other users to the database data displayed in the result set.

5. Provide access to data in result sets used in scripts, stored procedures and triggers? Transact-SQL? Statement. ?

Baidu encyclopedia-cursor