]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/move.sgml
f61a504b5f37b946cf178f99e4baa245eaedf134
[postgresql] / doc / src / sgml / ref / move.sgml
1 <!--
2 $PostgreSQL: pgsql/doc/src/sgml/ref/move.sgml,v 1.28 2004/06/17 12:41:02 momjian Exp $
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-MOVE">
7  <refmeta>
8   <refentrytitle id="SQL-MOVE-TITLE">MOVE</refentrytitle>
9   <refmiscinfo>SQL - Language Statements</refmiscinfo>
10  </refmeta>
11
12  <refnamediv>
13   <refname>MOVE</refname>
14   <refpurpose>position a cursor</refpurpose>
15  </refnamediv>
16
17  <indexterm zone="sql-move">
18   <primary>MOVE</primary>
19  </indexterm>
20
21  <indexterm zone="sql-move">
22   <primary>cursor</primary>
23   <secondary>MOVE</secondary>
24  </indexterm>
25
26  <refsynopsisdiv>
27 <synopsis>
28 MOVE [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursorname</replaceable>
29 </synopsis>
30  </refsynopsisdiv>
31
32  <refsect1>
33   <title>Description</title>
34
35   <para>
36    <command>MOVE</command> repositions a cursor without retrieving any data.
37    <command>MOVE</command> works exactly like the <command>FETCH</command>
38    command, except it only positions the cursor and does not return rows.
39   </para>
40
41   <para>
42    Refer to 
43    <xref linkend="sql-fetch" endterm="sql-fetch-title">
44    for details on syntax and usage.
45   </para>
46  </refsect1>
47
48  <refsect1>
49   <title>Outputs</title>
50
51   <para>
52    On successful completion, a <command>MOVE</> command returns a command
53    tag of the form
54 <screen>
55 MOVE <replaceable class="parameter">count</replaceable>
56 </screen>
57    The <replaceable class="parameter">count</replaceable> is the number
58    of rows that a <command>FETCH</command> command with the same parameters
59    would have returned (possibly zero).
60   </para>
61  </refsect1>
62
63  <refsect1>
64   <title>Examples</title>
65
66 <programlisting>
67 BEGIN WORK;
68 DECLARE liahona CURSOR FOR SELECT * FROM films;
69
70 -- Skip the first 5 rows:
71 MOVE FORWARD 5 IN liahona;
72 MOVE 5
73
74 -- Fetch the 6th row from the cursor liahona:
75 FETCH 1 FROM liahona;
76  code  | title  | did | date_prod  |  kind  |  len
77 -------+--------+-----+------------+--------+-------
78  P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
79 (1 row)
80
81 -- Close the cursor liahona and end the transaction:
82 CLOSE liahona;
83 COMMIT WORK;
84 </programlisting>
85  </refsect1>
86
87  <refsect1>
88   <title>Compatibility</title>
89         
90   <para>
91    There is no <command>MOVE</command> statement in the SQL standard.
92   </para>
93  </refsect1>
94 </refentry>
95
96 <!-- Keep this comment at the end of the file
97 Local variables:
98 mode: sgml
99 sgml-omittag:nil
100 sgml-shorttag:t
101 sgml-minimize-attributes:nil
102 sgml-always-quote-attributes:t
103 sgml-indent-step:1
104 sgml-indent-data:t
105 sgml-parent-document:nil
106 sgml-default-dtd-file:"../reference.ced"
107 sgml-exposed-tags:nil
108 sgml-local-catalogs:"/usr/lib/sgml/catalog"
109 sgml-local-ecat-files:nil
110 End:
111 -->