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: Mariano <mariano.calandra_at_gmail.com>
Date: 15 Apr 2007 12:03:47 -0700
Message-ID: <1176663827.907399.11260@o5g2000hsb.googlegroups.com>


On 15 Apr, 19:57, DA Morgan <damor..._at_psoug.org> wrote:
> 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
> damor..._at_x.washington.edu
> (replace x with u to respond)
> Puget Sound Oracle Users Groupwww.psoug.org

i will use a timestamp column, max timestamp will be surely last insert. Received on Sun Apr 15 2007 - 14:03:47 CDT

Original text of this message

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