- publishing free software manuals
PostgreSQL Reference Manual - Volume 2 - Programming Guide
by The PostgreSQL Global Development Group
Paperback (6"x9"), 408 pages
ISBN 0954612035
RRP £19.95 ($34.95)

Sales of this book support the PostgreSQL project! Get a printed copy>>>

9.8.2.2 OPEN FOR EXECUTE

OPEN unbound_cursor FOR EXECUTE query_string;

The cursor variable is opened and given the specified query to execute. The cursor cannot be open already, and it must have been declared as an unbound cursor (that is, as a simple refcursor variable). The query is specified as a string expression, in the same way as in the EXECUTE command. As usual, this gives flexibility so the query can vary from one run to the next.

An example:

OPEN curs1 FOR EXECUTE 'SELECT * FROM ' || quote_ident($1);
ISBN 0954612035PostgreSQL Reference Manual - Volume 2 - Programming GuideSee the print edition