Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: last row inserted in the table
Mariano wrote:
> How can I know what is the last row inserted in a table??? I have an
> ID column that is auto-incremented by the default auto-increment
> trigger.
>
> Can I be sure that MAX id number is the last row inserted?
What version and how was the table created?
Generally speaking this question indicates a lack of understanding of heap tables and how data is stored. But assuming that there is a sequence and trigger:
SELECT MAX(<id_column_name>)
FROM <table_name>;
Keep in mind that unless you are working on a single-user system this will inevitably give you an answer only valid for the current session.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Sun Apr 15 2007 - 12:57:52 CDT