Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to find last record in a table?

Re: How to find last record in a table?

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Wed, 14 Jan 2004 20:23:34 +0100
Message-ID: <40059704$0$7136$626a54ce@news.free.fr>

"B. Jones" <seismo_at_elvis.com> a écrit dans le message de news:e6ca440a.0401141103.1a52fb5c_at_posting.google.com...
> Hey, gang.
> I've been relying on a simple little statement that I THOUGHT would
> show me the last record in a table. I found out today that it's
> unreliable (returned records that were inserted on December 12 when
> there were records from today).
> Here's my statement...
> select * from <table> where rowid = (select max(rowid) from <table>);
>
> What do you guys do to find the last record in a table?
>
> Thanks.

There is nothing like last record in a relational database table. If you want the last inserted or updated record you have to add a timestamp column and a trigger to automatically set it when rows are inserted or modified.

Regards
Michel Cadot Received on Wed Jan 14 2004 - 13:23:34 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US