diff options
author | Neil Conway <neilc@samurai.com> | 2007-04-29 01:21:09 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2007-04-29 01:21:09 +0000 |
commit | 8690ebc26f26b2fe39d22eee8b76cab67a96bc09 (patch) | |
tree | f7305c11c76fbb54444c5c13531963b24a1fb51e /doc/src | |
parent | f2321a3f37b74b42d20ec787afb7ee4a29655a3e (diff) | |
download | postgresql-8690ebc26f26b2fe39d22eee8b76cab67a96bc09.tar.gz postgresql-8690ebc26f26b2fe39d22eee8b76cab67a96bc09.zip |
Support for MOVE in PL/PgSQL. Initial patch from Magnus, some improvements
by Pavel Stehule, and reviewed by Neil Conway.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/plpgsql.sgml | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 97090b7316d..c1f57ddf4f8 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.108 2007/04/28 23:54:58 neilc Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.109 2007/04/29 01:21:08 neilc Exp $ --> <chapter id="plpgsql"> <title><application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language</title> @@ -1524,6 +1524,13 @@ GET DIAGNOSTICS integer_var = ROW_COUNT; </listitem> <listitem> <para> + A <command>MOVE</> statement sets <literal>FOUND</literal> + true if it successfully repositions the cursor, false otherwise. + </para> + </listitem> + + <listitem> + <para> A <command>FOR</> statement sets <literal>FOUND</literal> true if it iterates one or more times, else false. This applies to all three variants of the <command>FOR</> statement (integer @@ -2567,6 +2574,53 @@ FETCH RELATIVE -2 FROM curs4 INTO x; </sect3> <sect3> + <title><literal>MOVE</></title> + +<synopsis> +MOVE <optional> <replaceable>direction</replaceable> { FROM | IN } </optional> <replaceable>cursor</replaceable>; +</synopsis> + + <para> + <command>MOVE</command> repositions a cursor without retrieving + any data. <command>MOVE</command> works exactly like the + <command>FETCH</command> command, except it only positions the + cursor and does not return rows. As with <command>SELECT + INTO</command>, the special variable <literal>FOUND</literal> can + be checked to see whether the cursor was successfully + repositioned or not. + </para> + + <para> + The <replaceable>direction</replaceable> clause can be any of the + variants allowed in the SQL <xref linkend="sql-move" + endterm="sql-move-title"> command except the ones that can move by + more than one row; namely, it can be + <literal>NEXT</>, + <literal>PRIOR</>, + <literal>FIRST</>, + <literal>LAST</>, + <literal>ABSOLUTE</> <replaceable>count</replaceable>, + <literal>RELATIVE</> <replaceable>count</replaceable>, + <literal>FORWARD</>, or + <literal>BACKWARD</>. + Omitting <replaceable>direction</replaceable> is the same + as specifying <literal>NEXT</>. + <replaceable>direction</replaceable> values that require moving + backward are likely to fail unless the cursor was declared or opened + with the <literal>SCROLL</> option. + </para> + + <para> + Examples: +<programlisting> +MOVE curs1; +MOVE LAST FROM curs3; +MOVE RELATIVE -2 FROM curs4; +</programlisting> + </para> + </sect3> + + <sect3> <title><literal>CLOSE</></title> <synopsis> |