Re: How do I retrieve last rec in a table?

From: Andy Hardy <Andrew.Hardy_at_BGTechnology.com>
Date: Thu, 5 Oct 2000 09:00:36 +0100
Message-ID: <8rhcct$suq$1_at_sun-cc204.lboro.ac.uk>


Dniel,

In Dev2K use the LAST_RECORD command to get to the last record in the block.

If you want to do this in PL/SQL cursor try something like:

SELECT service_provider_id

              ,provider_name
  FROM service_providers
 WHERE service_provider_id = (

                                                    SELECT
max(service_provider_id)
                                                      FROM service_providers
                                                )

Andy

--
Opinions are mine and may not reflect those of BG Technology Ltd

dniel navarro <dnavarro_at_intervoice.com> wrote in message
news:39DB8A78.679F8ECD_at_intervoice.com...

>
> This may be a dumb question, but how do you get the last record in a
> table. I would like to implement this feature in my Dev2K App where
> the user will hit a button and depending on the datablock hs/she is
> focused in on, the app will take them to the last record. I figured out
>
> how to get to the first record, but I'm stumped on how to retrieve the
> last one. This is my code so far that gets me to the last record...
>
> declare
> cursor cur_x is
> select
> service_provider_id,
> provider_name
> from service_providers
> order by service_provider_id;
>
> begin
> dbms_output.enable;
> for rec_x in cur_x loop
> dbms_output.put_line ('service provider id: ' ||
> rec_x.service_provider_id);
> end loop;
> end;
>
> NOTE: I'm using Oracle Server 8.0.5 on Solaris. Developer2K Rel.2.1
>
Received on Thu Oct 05 2000 - 10:00:36 CEST

Original text of this message