Add more explicit note that the parameters of MOVE are identical to FETCH.
[PostgreSQL.git] / doc / src / sgml / ref / move.sgml
blobb3ccf8a17c4bb16b3d28adf9981e7807ec458e71
1 <!--
2 $PostgreSQL$
3 PostgreSQL documentation
4 -->
6 <refentry id="SQL-MOVE">
7 <refmeta>
8 <refentrytitle id="SQL-MOVE-TITLE">MOVE</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
11 </refmeta>
13 <refnamediv>
14 <refname>MOVE</refname>
15 <refpurpose>position a cursor</refpurpose>
16 </refnamediv>
18 <indexterm zone="sql-move">
19 <primary>MOVE</primary>
20 </indexterm>
22 <indexterm zone="sql-move">
23 <primary>cursor</primary>
24 <secondary>MOVE</secondary>
25 </indexterm>
27 <refsynopsisdiv>
28 <synopsis>
29 MOVE [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursorname</replaceable>
30 </synopsis>
31 </refsynopsisdiv>
33 <refsect1>
34 <title>Description</title>
36 <para>
37 <command>MOVE</command> repositions a cursor without retrieving any data.
38 <command>MOVE</command> works exactly like the <command>FETCH</command>
39 command, except it only positions the cursor and does not return rows.
40 </para>
42 <para>
43 The parameters for the <command>MOVE</command> command are identical to
44 those of the <command>FETCH</command> command; refer to
45 <xref linkend="sql-fetch" endterm="sql-fetch-title">
46 for details on syntax and usage.
47 </para>
48 </refsect1>
50 <refsect1>
51 <title>Outputs</title>
53 <para>
54 On successful completion, a <command>MOVE</> command returns a command
55 tag of the form
56 <screen>
57 MOVE <replaceable class="parameter">count</replaceable>
58 </screen>
59 The <replaceable class="parameter">count</replaceable> is the number
60 of rows that a <command>FETCH</command> command with the same parameters
61 would have returned (possibly zero).
62 </para>
63 </refsect1>
65 <refsect1>
66 <title>Examples</title>
68 <programlisting>
69 BEGIN WORK;
70 DECLARE liahona CURSOR FOR SELECT * FROM films;
72 -- Skip the first 5 rows:
73 MOVE FORWARD 5 IN liahona;
74 MOVE 5
76 -- Fetch the 6th row from the cursor liahona:
77 FETCH 1 FROM liahona;
78 code | title | did | date_prod | kind | len
79 -------+--------+-----+------------+--------+-------
80 P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
81 (1 row)
83 -- Close the cursor liahona and end the transaction:
84 CLOSE liahona;
85 COMMIT WORK;
86 </programlisting>
87 </refsect1>
89 <refsect1>
90 <title>Compatibility</title>
92 <para>
93 There is no <command>MOVE</command> statement in the SQL standard.
94 </para>
95 </refsect1>
97 <refsect1>
98 <title>See Also</title>
100 <simplelist type="inline">
101 <member><xref linkend="sql-close" endterm="sql-close-title"></member>
102 <member><xref linkend="sql-declare" endterm="sql-declare-title"></member>
103 <member><xref linkend="sql-fetch" endterm="sql-fetch-title"></member>
104 </simplelist>
105 </refsect1>
106 </refentry>