The PL/SQL code in order to return the second latest record ?
2 thoughts on “PL/SQL: How to query 2nd record only if sorted by date?”
Leave a Comment
You must be logged in to post a comment.
The PL/SQL code in order to return the second latest record ?
You must be logged in to post a comment.
select whatEverfrom whereEver. . . order by yourDateField desc
select a. * from (select s. *,max(rn) over() maxr from (select TABLE. *,rownum rn from TAB1 order by rownum desc) s ) a where maxr-1=rn;Replace TABLE with the desired table name.