Assuming that v_num
is supposed to be the number of elements that you want returned, it sounds like you'd want to do something like
select *
from (select rank, item
from itemtable
order by rank asc)
where rownum <= v_num
order by rank desc
If that's not what you're after, it would be helpful to post a test case (the DDL to create a table, the DML to populate that table, and the expected results) or a link to a fiddle that we can work with.