Re: Replacement for Oracle's "ROWNUM" in Postgres
От | Csaba Nagy |
---|---|
Тема | Re: Replacement for Oracle's "ROWNUM" in Postgres |
Дата | |
Msg-id | 96D568DD7FAAAD428581F8B3BFD9B0F604DE98@goldmine.ecircle.de обсуждение исходный текст |
Ответ на | Replacement for Oracle's "ROWNUM" in Postgres (Csaba Nagy <nagy@domeus.de>) |
Список | 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@postgresql.org [mailto:pgsql-general-owner@postgresql.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? http://www.postgresql.org/users-lounge/docs/faq.html
В списке pgsql-general по дате отправления: