meta data for this page
  •  

FETCH cursor

Available in: PSQL

Added in: 2.0

Description

Fetches the next data row from a cursor's result set and stores the column values in PSQL variables.

Syntax

FETCH cursorname INTO [:]varname [, [:]varname ...];

Notes

  • The ROW_COUNT context variable will be 1 if the fetch returned a data row and 0 if the end of the set has been reached.
  • You can do a positioned UPDATE or DELETE on the fetched row with the WHERE CURRENT OF clause.

Example

See DECLARE ... CURSOR.