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: DA Morgan <damorgan_at_psoug.org>
Date: Sun, 15 Apr 2007 10:57:52 -0700
Message-ID: <1176659864.175082@bubbleator.drizzle.com>


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.org
Received on Sun Apr 15 2007 - 12:57:52 CDT

Original text of this message

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