Status Information

Status information from @@sqlstatus and @@fetch_status global variables.

Only a fetch statement can set @@sqlstatus and @@fetch_status. Other statements have no effect on @@sqlstatus or @@fetch_status.

The @@sqlstatus global variable holds status information (warning exceptions) resulting from the execution of a fetch statement. Its value reflects the last cursor fetched:

Value

Description

0

Indicates successful completion of the fetch statement.

1

Indicates that the fetch statement resulted in an error.

2

Indicates that there is no more data in the result set. This warning can occur if the current cursor position is on the last row in the result set and the client submits a fetch statement for that cursor.

The @@fetch_status global variable provides information about whether fetch is executed successfully in a scrollable cursor:

Value

Description

0

Indicates successful completion of the fetch statement.

-1

Indicates that the fetch operation failed, or the row fetched was beyond the result set.

-2

Reserved for future use.