On Thu, 2005-05-12 at 14:07, 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:
>
> select *
> from (select RowNum, pg_catalog.pg_proc.*
> from pg_catalog.pg_proc) inline_view
> where RowNum between 100 and 200;
You can get a functional equivalent with a temporary sequence:
create temp sequence rownum;
select *, nextval('rownum') as rownum from sometable;