Can I do <page> of <pages> in one call?

From: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Can I do <page> of <pages> in one call?
Date: 2003-06-16 16:43:54
Message-ID: 20030616164354.GA4515@campbell-lange.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am writing a function to interrogate the database and get a total row
count of rows matching the critera of a search, and then return a subset
of those rows. This is to satisfy the familiar web <page> of <pages>
situation.

At the moment I call the query twice, one with limit and offset
statements, the other without these. I use ROW_COUNT after the second.

Is it possible to do a query, get the ROW_COUNT, and then use a cursor
or something similar to get the subset into a setof result%rowtype?

Thanks!
Rory

--
Rory Campbell-Lange
<rory(at)campbell-lange(dot)net>
<www.campbell-lange.net>

Browse pgsql-general by date

  From Date Subject
Next Message Carlos 2003-06-16 16:45:55 Excluding tables from pg_restore
Previous Message Avi Schwartz 2003-06-16 16:32:51 Re: Why can't you define a table alias on an update?