1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
<!-- manual page source format generated by PolyglotMan v3.0.4, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
<HTML>
<HEAD>
<TITLE>FETCH(SQL) manual page</TITLE>
</HEAD>
<BODY>
<A HREF="sql.html">SQL Reference Contents</A>
<H2><A NAME="sect0" HREF="#toc0">NAME </A></H2>
fetch - fetch instance(s) from a cursor
<H2><A NAME="sect1" HREF="#toc1">SYNOPSIS </A></H2>
<B>fetch </B> [ (<B>forward
</B> | <B>backward </B>) ] [ ( number | <B>all </B>) ] [<B>in </B> cursor_name] <BR>
<H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2>
<B>Fetch</B>
allows a user to retrieve instances from a cursor named <I>cursor_name.</I> The
number of instances retrieved is specified by <I>number</I>. If the number of
instances remaining in the cursor is less than <I>number</I>, then only those
available are fetched. Substituting the keyword <I>all</I> in place of a number
will cause all remaining instances in the cursor to be retrieved. Instances
may be fetched in both <I>forward</I> and <I>backward</I> directions. The default direction
is <I>forward</I>. <P>
Updating data in a cursor is not supported by Postgres, because
mapping cursor updates back to base classes is impossible in general as
with view updates. Consequently, users must issue explicit replace commands
to update data. <P>
Cursors may only be used inside of transaction blocks marked
by <I><A HREF="begin.l.html">begin</I>(l)</A>
and <I><A HREF="end.l.html">end</I>(l)</A>
because the data that they store spans multiple
user queries.
<H2><A NAME="sect3" HREF="#toc3">EXAMPLE </A></H2>
-- <BR>
--set up and use a cursor <BR>
-- <BR>
begin <BR>
declare
mycursor cursor for <BR>
select * from pg-user; <BR>
-- <BR>
--Fetch all the instances
available in the cursor FOO <BR>
-- <BR>
fetch all in FOO; <BR>
-- <BR>
--Fetch 5 instances
backward in the cursor FOO <BR>
-- <BR>
fetch backward 5 in FOO; <BR>
-- <BR>
--close <BR>
-- <BR>
close foo; <BR>
end; <BR>
<H2><A NAME="sect4" HREF="#toc4">SEE ALSO </A></H2>
<A HREF="begin.l.html">begin(l)</A>
, <A HREF="end.l.html">end(l)</A>
, <A HREF="close.l.html">close(l)</A>
, <A HREF="move.l.html">move(l)</A>
, <A HREF="select.l.html">select(l)</A>
.
<P>
<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc0" HREF="#sect0">NAME</A></LI>
<LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI>
<LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI>
<LI><A NAME="toc3" HREF="#sect3">EXAMPLE</A></LI>
<LI><A NAME="toc4" HREF="#sect4">SEE ALSO</A></LI>
</UL>
</BODY></HTML>
|