how to display data in descending order without using ORDER BY CLAUSE in Oracle

旧时模样 提交于 2019-12-04 07:13:28

问题


I am new in oracle and I have one question i.e.: how to display data in descending order without using ORDER BY CLAUSE in Oracle. whether it is in sql or pl/sql.


回答1:


It is not possible to reliably retrieve sorted results without explicitly using ORDER BY... if you cannot use ORDER BY, you would need to organize the code in whichever programming language you're using to pull the data with which is ridiculous.




回答2:


Avoid ORDER BY, use a hierarchical query with flat results, and ORDER SIBLINGS! (okay, this will be exactly the same).

You can also do it with:

SELECT * FROM ...
START WITH 1 = 1
CONNECT BY 0 = 1
ORDER SIBLINGS BY ...



回答3:


to sort ename in ascending order without using order by clause:

select ename from emp
union
select ename from emp;


来源:https://stackoverflow.com/questions/9585390/how-to-display-data-in-descending-order-without-using-order-by-clause-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!