2 doc/src/sgml/ref/move.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-MOVE">
8 <refentrytitle>MOVE</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
14 <refname>MOVE</refname>
15 <refpurpose>position a cursor</refpurpose>
18 <indexterm zone="sql-move">
19 <primary>MOVE</primary>
22 <indexterm zone="sql-move">
23 <primary>cursor</primary>
24 <secondary>MOVE</secondary>
28 <!-- Note the "direction" bit is also in ref/fetch.sgml -->
30 MOVE [ <replaceable class="PARAMETER">direction</replaceable> [ FROM | IN ] ] <replaceable class="PARAMETER">cursor_name</replaceable>
32 <phrase>where <replaceable class="PARAMETER">direction</replaceable> can be empty or one of:</phrase>
38 ABSOLUTE <replaceable class="PARAMETER">count</replaceable>
39 RELATIVE <replaceable class="PARAMETER">count</replaceable>
40 <replaceable class="PARAMETER">count</replaceable>
43 FORWARD <replaceable class="PARAMETER">count</replaceable>
46 BACKWARD <replaceable class="PARAMETER">count</replaceable>
52 <title>Description</title>
55 <command>MOVE</command> repositions a cursor without retrieving any data.
56 <command>MOVE</command> works exactly like the <command>FETCH</command>
57 command, except it only positions the cursor and does not return rows.
61 The parameters for the <command>MOVE</command> command are identical to
62 those of the <command>FETCH</command> command; refer to
63 <xref linkend="sql-fetch">
64 for details on syntax and usage.
69 <title>Outputs</title>
72 On successful completion, a <command>MOVE</> command returns a command
75 MOVE <replaceable class="parameter">count</replaceable>
77 The <replaceable class="parameter">count</replaceable> is the number
78 of rows that a <command>FETCH</command> command with the same parameters
79 would have returned (possibly zero).
84 <title>Examples</title>
88 DECLARE liahona CURSOR FOR SELECT * FROM films;
90 -- Skip the first 5 rows:
91 MOVE FORWARD 5 IN liahona;
94 -- Fetch the 6th row from the cursor liahona:
96 code | title | did | date_prod | kind | len
97 -------+--------+-----+------------+--------+-------
98 P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
101 -- Close the cursor liahona and end the transaction:
108 <title>Compatibility</title>
111 There is no <command>MOVE</command> statement in the SQL standard.
116 <title>See Also</title>
118 <simplelist type="inline">
119 <member><xref linkend="sql-close"></member>
120 <member><xref linkend="sql-declare"></member>
121 <member><xref linkend="sql-fetch"></member>