Global Variables

Adaptive Server 15.0 introduces new global variables.

New global variables

Variable

What it displays

Value

@@rowcount

Enhanced to display the number of rows moved by a cursor, scrollable or nonscrollable.

In a nonscrollable cursor, the rows are fetched from the underlying tables to the client.

In a scrollable cursor, the rows counted are fetched from the current result set, not from the underlying tables.

The value of the global variable @@rowcount is affected by the specified cursor type.

The default, non-scrollable cursor moves forward one row at a time; the maximum value is the number of rows in the result set.

In a scrollable cursor the value of continues to increment, whatever the direction of the fetch command; there is no maximum value.

@@fetch_status

The status of a fetch command used for a scrollable cursor.

0 – fetch statement successfully executed.

-1 – either the fetch statement failed, or the row requested is outside the result set.

-2 – value reserved.

@@cursor_rows

The total number of rows in the cursor result set.

0 – No cursors are open, or no rows qualify for the last open cursor.

-1 – Semi-sensitive and scrollable, but the scrolling worktable is not yet populated. The number of rows that qualify the cursor is unknown.

n – The last opened or fetched cursor result set is fully populated; the value returned is the total number of rows in the result set.