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

Home -> Community -> Usenet -> c.d.o.server -> Re: Retrieve last N rows

Re: Retrieve last N rows

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Tue, 21 May 2002 15:11:40 GMT
Message-ID: <3CEA63A1.C60FC0BE@exesolutions.com>


Md Irfan wrote:

> "Jim Kennedy" <kennedy-family_at_attbi.com> wrote in message news:<_9hG8.67964$UV4.87535_at_rwcrnsc54>...
> > Md,
> > You need to define what the last 10 rows of a table means. Tables are sets
> > of data (called tuples in math language) and an unordered set does not have
> > a last. So you need to specify what last means. For example, if you keep
> > track of when a record is inserted you might want the 10 most recently
> > inserted (or last) records. If you don't keep track of when they were
> > inserted then you can't know which ones they are.
> >
> > So you really do have to explain what last means to get the last 10 rows.
>
> Jim,
> We have table that does not contain date column. So normally some 50
> rows are inserted to this table daily. Just I want to see the last 50
> rows.

You can not do it.

Database tables are not physically or logically ordered like, for example, an index. The only way to know which 50 rows were last inserted is to have a column defined as follows:

INSERT_DATE DATE DEFAULT SYSDATE Daniel Morgan Received on Tue May 21 2002 - 10:11:40 CDT

Original text of this message

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