PostgreSQL/doc/src/sgml/ref/move.sgml
2003-08-31 17:32:24 +00:00

102 lines
2.3 KiB
Plaintext

<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/move.sgml,v 1.23 2003/08/31 17:32:23 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-MOVE">
<refmeta>
<refentrytitle id="SQL-MOVE-TITLE">MOVE</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>MOVE</refname>
<refpurpose>reposition a cursor</refpurpose>
</refnamediv>
<indexterm zone="sql-move">
<primary>MOVE</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
MOVE [ <replaceable class="PARAMETER">direction</replaceable> { FROM | IN } ] <replaceable class="PARAMETER">cursor</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<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 repositions the cursor and does not return rows.
</para>
<para>
Refer to
<xref linkend="sql-fetch" endterm="sql-fetch-title">
for details on syntax and usage.
</para>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<para>
The count returned in <command>MOVE</command>'s status string is
the count of the number of rows that would have been returned by
the equivalent <command>FETCH</command> command.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<programlisting>
BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;
-- Skip the first 5 rows:
MOVE FORWARD 5 IN liahona;
MOVE 5
-- 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
(1 row)
-- Close the cursor liahona and end the transaction:
CLOSE liahona;
COMMIT WORK;
</programlisting>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
There is no <command>MOVE</command> statement in the SQL standard.
</para>
</refsect1>
</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:
-->