sql - Set cursor order to desc but still start at beginning of table? -
I have a problem with the backing of a cursor I have a ranking of items if input 2 is, then I I want to select item 1 and 2, but to show it this way;
rank 2 1 Now, when
<
My cursor just follows
by order of items based on rank Choose; Used in the loop in this way:
FOR i IN REVERSE 1..v_num LOOP dBMS_ OUTPUT.PUT_LINE (to_char (v_RANK) || To_char (v_ITEM); v_arank, v_item; when CIrCank * notesfonds; and loop; Carchcatch when there are number of items to be displayed. I have tried to set For asc and then desc (like order asc, rank desc , both), but that does not work. Reverse output I have seen other such questions which are similar but no answer was found, I am stumped. It has been an easy decision, I just can not seem to know what it is.
Assuming that v_num is considered the number of elements that you You want to return, it looks as if you choose from * (rank select, order rank from the order ACC gate This item) where rownum & lt; = V_num orde based on rank If you are not doing this then this test will be helpful in posting the case (to create DDL table, to DML to populate that table For, and expected results) or we can work with it.
Comments
Post a Comment