A simple trick can help you to overcome this issue. Just escape the ApEx internal #ROWNUM# like this:
SELECT '#ROWNUM#' SEQUENCE, empno, ename, sal
and it will give you the right ROWNUM regardless of your sorting.
You can see that working in this example in my Demo Application.