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

Home -> Community -> Usenet -> c.d.o.misc -> Re: last row inserted in the table

Re: last row inserted in the table

From: <sybrandb_at_hccnet.nl>
Date: Sun, 15 Apr 2007 17:43:44 +0200
Message-ID: <pth4231218u00h8a1fmpmv3ur4eqsik1sh@4ax.com>


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

Original text of this message

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