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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Display last records in a table

Re: Display last records in a table

From: Michael Dodd <doddme_at_mindspring.com>
Date: Sat, 26 May 2001 09:17:51 -0500
Message-ID: <4nevgt4oubgknt08et1q7rmft9a9rtu8tv@4ax.com>

SQL> create table test_dates (my_int number, my_date date);

Table created.

SQL> declare i number;
  2 begin
  3 for i in 1 .. 1000 loop
  4 insert into test_dates values(i,sysdate+i);   5 end loop
  6 ;
  7 end;
  8 /

PL/SQL procedure successfully completed.

SQL> select count(*) from test_dates;

  COUNT(*)


      1000

SQL> select max(my_date) from test_dates;

MAX(MY_DA



20-FEB-04 SQL> select my_date from (select my_date,rownum from test_dates order by rownum desc) where rownum <
 10;

MY_DATE


20-FEB-04
19-FEB-04
18-FEB-04
17-FEB-04
16-FEB-04
15-FEB-04
14-FEB-04
13-FEB-04
12-FEB-04

9 rows selected.

SQL> On Fri, 25 May 2001 17:04:59 +0200, "Thomas Stuefer" <stuefer_at_halli-data.at> wrote:

>How can i display the last records in a table with an select-statement ?
>
>For example:
>
>I have an table with many thousand of records and only want to display the
>last 10 added records.
>
>Many thanks for your help !
>
>Tom
>
>
  Received on Sat May 26 2001 - 09:17:51 CDT

Original text of this message

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