Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to find last record in a table?
"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
![]() |
![]() |