1, order by is logical order, while rownum is based on the physical position; in a temporary table generated by a subquery, the logical order and the physical order are one and the same.
2, without order by and only <=
select *
from T_PF_DEP
where ROWNUM <= 5000;
3, without order by and both <= and >
select *
from (select * from T_PF_USER where ROWNUM <= 500) t
where ROWNUM > 0;
4, with order by
select *
from (select * from T_PF_DEP order by T_PF_DEP.DEPCODE) t
where ROWNUM <= 5000;
select *
from (select * from (select * from T_PF_DEP order by T_PF_DEP.DEPCODE) t where ROWNUM <= 500) tt
where ROWNUM > 0;