Declare
Defines a new cursor.
Synopsis
DECLARE cursorname [ BINARY ] [ INSENSITIVE ] [ SCROLL ] CURSOR FOR query [ FOR { READ ONLY | UPDATE [ OF column [, ...] ] } ]
Parameters
cursorname
The name of the new cursor.
BINARY
The
BINARY
keyword causes the cursor to fetch data in binary format, rather than in the default text format.INSENSITIVE
The
INSENSITIVE
keyword 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.SCROLL
The
SCROLL
keyword allows data to be retrieved in multiple rows perFETCH
operation. However, specifying it will have no effect, as PostgreSQL already allows this functionality implicitly.query
The 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 ONLY
The
READ ONLY
clause 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.UPDATE
The
UPDATE
clause 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).column
The columns to be updated; however, cursor updates are not currently ...
Get Practical PostgreSQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.