From: | Csaba Nagy <nagy(at)domeus(dot)de> |
---|---|
To: | "'pgsql-general'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Replacement for Oracle's "ROWNUM" in Postgres |
Date: | 2002-12-20 09:11:50 |
Message-ID: | 96D568DD7FAAAD428581F8B3BFD9B0F604DE98@goldmine.ecircle.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks guys for the answer !
The sequence solution works perfect for me.
Using OIDs is not the best solution, because I expect a sequence running
from 1 to the nr. of updated rows.
BTW, the 1..n sequence should have rang a bell...
Thanks again,
Csaba.
-----Ursprungliche Nachricht-----
Von: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]Im Auftrag von Shridhar
Daithankar
Gesendet: Freitag, 20. Dezember 2002 08:32
An: 'pgsql-general'
Betreff: Re: [GENERAL] Replacement for Oracle's "ROWNUM" in Postgres
On 19 Dec 2002 at 11:30, Bill Gribble wrote:
> On Thu, 2002-12-19 at 10:58, Csaba Nagy wrote:
> > This query is setting a date into a column for all the rows, starting
with a
> > fixed date with 10 minutes intervals.
> >
> > UPDATE some_table
> > SET some_date_column = 'some_literal_date' + (ROWNUM / 144.0);
> One way:
>
> CREATE SEQUENCE dateseq;
>
> UPDATE some_table
> SET some_date_column = 'some_literal_date' +
> (nextval('dateseq') / 144.0)
>
> DROP SEQUENCE dateseq;
Or use OID..
Bye
Shridhar
--
On-line, adj.: The idea that a human being should always be accessible to a
computer.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Lamb | 2002-12-20 10:18:42 | Re: IN or EXISTS?? faster one |
Previous Message | Shridhar Daithankar | 2002-12-20 07:31:58 | Re: Replacement for Oracle's "ROWNUM" in Postgres |