Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Latest n rows of table - without a nested select
Hi,
Within oracle SPL, I want to select 2 columns of the latest n rows
of a table.
I currently do this with a nested select.
For example to get columns a and b of the most recent single row of
table a_journal:
select a,b into p_a, p_b FROM (SELECT a, b, from a_journal where (c = 'O' or c = 'A') order by system_date desc) where rownum = 1;
Is there any way of doing this in a single select (i.e. not using a
nested select)
Note: The table also contains a sequence (the tables primary key).
Can this be used ?
Any help appreciated,
Peter
Received on Mon Oct 24 2005 - 08:59:48 CDT
![]() |
![]() |