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: Getting first/last record

Re: Getting first/last record

From: <mflahertyLUQTJC_at_ukonline.co.uk>
Date: 20 Jul 1999 12:53:28 GMT
Message-ID: <7n1rg8$kfl$1@apple.news.easynet.net>

And as MAX(col_name) performs a full table scan does anyone have any ideas on using any Relational Databases, such as Oracle, to obtain the last value stored ?

This is something we are looking at here. we don't want to do a full table scan every time as our tables are very large, ie 4Gb + for a table will be the norm.

Our current solution incorporates our own 'catalogue' tables which track the latest generation times of records in the table. This can then be used to pick out, using an index on generation_time, the latest record from our data table. The generation_time in our catalogue is filled using an after update trigger.

Mike.

>In a relational database there is no concept of first and last
record. For
>any given query there will be, of course, the first record returned
and the
>final record returned, but it is entirely based on the query not on
the
>table. In addition, there is also no concept of an ordered table. It
is
>possible to load a table from data that is sorted and in many cases
if you
>perform a simple query (i.e. select * from table1;) you will get it
back in
>the same order, but to some degree that is coincidence.
>
>Ken
>
>STEVE wrote:
>
>> Hi,
>> Being a bit of a newbee, to oracle8 can anybody help with the
following.
>> 1.How to get the first record in an ordered table
>> 2 How to get the last record in an ordered table.
>> the order being on date then time.
>>
>> In fox pro it's easy,
>> set order to date88 (index)
>> go top
>> go bottom
>>
>> steve
>

Please remove the LUQTJC before replying by email.

 Go to http://www.ukonline.co.uk to find out  about other online services we offer our subscribers. Received on Tue Jul 20 1999 - 07:53:28 CDT

Original text of this message

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