| From: | "Shridhar Daithankar" <shridhar_daithankar(at)persistent(dot)co(dot)in> |
|---|---|
| To: | "'pgsql-general'" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Replacement for Oracle's "ROWNUM" in Postgres |
| Date: | 2002-12-20 07:31:58 |
| Message-ID: | 3E0314C6.7602.E186EBA@localhost |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Csaba Nagy | 2002-12-20 09:11:50 | Re: Replacement for Oracle's "ROWNUM" in Postgres |
| Previous Message | Graham Leggett | 2002-12-20 07:28:26 | Unable to format timestamp with time zone; internal coding error |