Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: last row inserted in the table
On 15 Apr 2007 06:26:56 -0700, "Mariano" <mariano.calandra_at_gmail.com>
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?
This depends on the definition of 'last', but theoretically all sets
are unordered.
If you use an Oracle SEQUENCE and don't use the NOCACHE option, there
is NO guarantee the record with the highest ID is the 'last' in wall
clock time.
The best solution would be to add a timestamp column, and set it in
the trigger.
Sybrand Bakker
Senior Oracle DBA
Received on Sun Apr 15 2007 - 10:43:44 CDT
![]() |
![]() |