pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Dennis.Jiang@thomson.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle?
Date: Tue, 17 May 2005 12:06:16 -0500
Message-ID: <20050517170616.GA20919@wolff.to> (raw)
In-Reply-To: <DCD4903594CCF34CAFE200BDF3448D8D5B291A@tshuscodenmbx01.ERF.THOMSON.COM>
References: <DCD4903594CCF34CAFE200BDF3448D8D5B291A@tshuscodenmbx01.ERF.THOMSON.COM>

On Thu, May 12, 2005 at 13:07:00 -0600,
  Dennis.Jiang@thomson.com wrote:
> Hi:
> 
> Oracle has a pseudo-column "ROWNUM" to return the sequence number in which a row was returned when selected from a table. The first row ROWNUM is 1, the second is 2, and so on.
> 
> Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle? If so, we can write the following query:

No.

> 
> select * 
> from (select RowNum, pg_catalog.pg_proc.* 
>         from pg_catalog.pg_proc) inline_view
> where RowNum between 100 and 200;

You could use LIMIT and OFFSET to get the values from the table for the
100th through 200th rows (though typically you want to add an ORDER BY
clause). You could have you application supply the rownum column values.



view thread (17+ messages)  latest in thread

Message-ID: <20050517170616.GA20919@wolff.to>
Permalink:  ../20050517170616.GA20919@wolff.to/
Also on:    postgresql.org/message-id/20050517170616.GA20919@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, Dennis.Jiang@thomson.com
  Subject: Re: Does Postgresql have a similar pseudo-column "ROWNUM" as Oracle?
  In-Reply-To: <20050517170616.GA20919@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox