Sql 简明教程

SQL - Cursor Functions

在 SQL Server 中,游标是数据库对象,它使我们能够逐行检索和修改单个行中的数据。游标实际只是一行指针。它总是与 SELECT 语句一起使用。通常,它由一组 SQL 语句组成,这些语句逐行遍历一组指定数量的行。

In SQL Server, a cursor is a database object that enables us to retrieve and modify data from individual rows one at a time. Nothing more than a row pointer is what a cursor actually is. It always goes together with a SELECT statement. Typically, it consists of a set of SQL statements that iterate through each row one at a time in a set number of rows.

所有游标函数都是非确定性的。换句话说,即使具有相同的输入值集,在调用时,这些函数也会提供不同的结果。

All Cursor functions are nondeterministic. To put it another way, even with the identical set of input values, these functions do not provide the same outcomes when called.

List of Functions

下面列出了返回 SQL Server 中游标信息的标量函数 -

Following is a list of scalar functions that returns information about cursors in the SQL server −

Sr.No.

Function & Description

1

@@CURSOR_ROWSIs used to determine the number of rows in the current cursor.

2

@@FETCH_STATUSIs used to retrieve the most recent opened cursor’s current fetch status.

3

CURSOR_STATUSIs used to determine the current cursor’s status.