Thread: Re: [SQL] Select... RANGE?

Re: [SQL] Select... RANGE?

From
"David Hartwig"
Date:
See DECLARE CURSOR, MOVE and FETCH.


----- Original Message -----
From: Tim Perdue, The Des Moines City.net <tim@dmcity.net>
To: <pgsql-sql@hub.org>
Sent: Saturday, January 23, 1999 2:52 PM
Subject: [SQL] Select... RANGE?


>I'm not finding any sample code that allows you to select a range in a
>result set.
>
>Let's say my query matches 500 records. I want it to return records
100-125.
>I'm pretty sure I've seen this done, but I don't know where/how.
>
>Tim
>
>


Re: [SQL] Select... RANGE?

From
Oleg Bartunov
Date:
Hello,

I think the original poster was thinking about feature-patch avalaiable
at patches directory which was well done by Jan.
It's not approved by Jan how it works with 6.4.2 but
I use it with 6.4.2 (actually patch which was posted in hackers mailing list)
and it works fine for my purposes.

from README:

 Feature coming with this patch:

    LIMIT   This is a new option to the SELECT statement, telling
            the  database  that  only  some  of the rows selected
            should be returned in the result set.

            The added syntax of the LIMIT option is:

                SELECT ... [LIMIT {ALL | lim} [, off]];
            or
                SELECT ... [LIMIT {ALL | lim}] [OFFSET off];

            where lim is a positive integer  value  greater  than
            zero  and off is an integer value greater or equal to
            zero. Both values can be specified as Parameters when
            using the server programming interface (SPI). In this
            case, a zero value given in the argument for the  lim
            parameter means ALL.


    Regards,


            Oleg

On Sat, 23 Jan 1999, David Hartwig wrote:

> Date: Sat, 23 Jan 1999 18:06:09 -0500
> From: David Hartwig <daybee@bellatlantic.net>
> To: "Tim Perdue, The Des Moines City.net" <tim@dmcity.net>,
>     pgsql-sql@hub.org
> Subject: Re: [SQL] Select... RANGE?
>
> See DECLARE CURSOR, MOVE and FETCH.
>
>
> ----- Original Message -----
> From: Tim Perdue, The Des Moines City.net <tim@dmcity.net>
> To: <pgsql-sql@hub.org>
> Sent: Saturday, January 23, 1999 2:52 PM
> Subject: [SQL] Select... RANGE?
>
>
> >I'm not finding any sample code that allows you to select a range in a
> >result set.
> >
> >Let's say my query matches 500 records. I want it to return records
> 100-125.
> >I'm pretty sure I've seen this done, but I don't know where/how.
> >
> >Tim
> >
> >
>
>

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83