class="parameter">count</replaceable> is a
possibly-signed integer constant, determining the location or
number of rows to fetch. For <literal>FORWARD</literal> and
<literal>BACKWARD</literal> cases, specifying a negative <replaceable
class="parameter">count</replaceable> is equivalent to changing
the sense of <literal>FORWARD</literal> and <literal>BACKWARD</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">cursor_name</replaceable></term>
<listitem>
<para>
An open cursor's name.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Outputs</title>
<para>
On successful completion, a <command>FETCH</command> command returns a command
tag of the form
<screen>
FETCH <replaceable class="parameter">count</replaceable>
</screen>
The <replaceable class="parameter">count</replaceable> is the number
of rows fetched (possibly zero). Note that in
<application>psql</application>, the command tag will not actually be
displayed, since <application>psql</application> displays the fetched
rows instead.
</para>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
The cursor should be declared with the <literal>SCROLL</literal>
option if one intends to use any variants of <command>FETCH</command>
other than <command>FETCH NEXT</command> or <command>FETCH FORWARD</command> with
a positive count. For simple queries
<productname>PostgreSQL</productname> will allow backwards fetch
from cursors not declared with <literal>SCROLL</literal>, but this
behavior is best not relied on. If the cursor is declared with
<literal>NO SCROLL</literal>, no backward fetches are allowed.
</para>
<para>
<literal>ABSOLUTE</literal> fetches are not any faster than
navigating to the desired row with a relative move: the underlying
implementation must traverse all the intermediate rows anyway.
Negative absolute fetches are even worse: the query must be read to
the end to find the last row, and then traversed backward from
there. However, rewinding to the start of the query (as with
<literal>FETCH ABSOLUTE 0</literal>) is fast.
</para>
<para>
<link linkend="sql-declare"><command>DECLARE</command></link>
is used to define a cursor. Use
<link linkend="sql-move"><command>MOVE</command></link>
to change