move.sgml 2.91 KB
Newer Older
1
<!--
2
$PostgreSQL: pgsql/doc/src/sgml/ref/move.sgml,v 1.29 2005/01/04 00:39:53 tgl Exp $
3
PostgreSQL documentation
4 5
-->

6 7
<refentry id="SQL-MOVE">
 <refmeta>
8
  <refentrytitle id="SQL-MOVE-TITLE">MOVE</refentrytitle>
9 10
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>
11

12
 <refnamediv>
13
  <refname>MOVE</refname>
14
  <refpurpose>position a cursor</refpurpose>
15 16
 </refnamediv>

Peter Eisentraut's avatar
Peter Eisentraut committed
17 18 19 20
 <indexterm zone="sql-move">
  <primary>MOVE</primary>
 </indexterm>

21 22 23 24 25
 <indexterm zone="sql-move">
  <primary>cursor</primary>
  <secondary>MOVE</secondary>
 </indexterm>

26
 <refsynopsisdiv>
27
<synopsis>
28
MOVE [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursorname</replaceable>
29
</synopsis>
30 31
 </refsynopsisdiv>

32 33 34
 <refsect1>
  <title>Description</title>

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>
Thomas G. Lockhart's avatar
Thomas G. Lockhart committed
47

48
 <refsect1>
49
  <title>Outputs</title>
50

51
  <para>
52 53 54 55 56 57
   On successful completion, a <command>MOVE</> command returns a command
   tag of the form
<screen>
MOVE <replaceable class="parameter">count</replaceable>
</screen>
   The <replaceable class="parameter">count</replaceable> is the number
58 59
   of rows that a <command>FETCH</command> command with the same parameters
   would have returned (possibly zero).
60
  </para>
61
 </refsect1>
Thomas G. Lockhart's avatar
Thomas G. Lockhart committed
62

63 64
 <refsect1>
  <title>Examples</title>
Thomas G. Lockhart's avatar
Thomas G. Lockhart committed
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 75 76 77 78

-- Fetch the 6th row from the cursor liahona:
FETCH 1 FROM liahona;
 code  | title  | did | date_prod  |  kind  |  len
-------+--------+-----+------------+--------+-------
 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 83
CLOSE liahona;
COMMIT WORK;
84
</programlisting>
85
 </refsect1>
86

87 88
 <refsect1>
  <title>Compatibility</title>
89

90 91 92
  <para>
   There is no <command>MOVE</command> statement in the SQL standard.
  </para>
93
 </refsect1>
94 95 96 97 98 99 100 101 102 103

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-close" endterm="sql-close-title"></member>
   <member><xref linkend="sql-declare" endterm="sql-declare-title"></member>
   <member><xref linkend="sql-fetch" endterm="sql-fetch-title"></member>
  </simplelist>
 </refsect1>
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->