Declare
Defines a new cursor.
Synopsis
DECLARE cursorname [ BINARY ] [ INSENSITIVE ] [ SCROLL ] CURSOR FOR query [ FOR { READ ONLY | UPDATE [ OF column [, ...] ] } ]
Parameters
cursornameThe name of the new cursor.
BINARYThe
BINARYkeyword causes the cursor to fetch data in binary format, rather than in the default text format.INSENSITIVEThe
INSENSITIVEkeyword specifies that all data retrieved from the cursor will be unchanged by updates from other processes (and other cursors). This option is unneeded when using PostgreSQL, as the database already encapsulates all cursor operations within transactions. This option exists for compatibility with other database systems.SCROLLThe
SCROLLkeyword allows data to be retrieved in multiple rows perFETCHoperation. However, specifying it will have no effect, as PostgreSQL already allows this functionality implicitly.queryThe SQL query that will provide the new cursor with rows. For information on how to construct this query, see the reference entry titled “SELECT.”
READ ONLYThe
READ ONLYclause indicates that the cursor will be used only to read data (read-only mode). Using this keyword has no effect, as PostgreSQL already only provides read-only access for use with cursors.UPDATEThe
UPDATEclause specifies that the cursor will be used to update tables; however, updates from cursors are not supported as of PostgreSQL 7.1.x (the current version at the printing of this book).columnThe columns to be updated; however, cursor updates are not currently ...