隨機排序

Nalternative發表於2012-01-12

--隨機排序
SELECT *
FROM (select level from dual connect by level<10)
ORDER BY DBMS_RANDOM.VALUE

--order by的數字比列數大:
SELECT *
FROM (select level from dual connect by level<10)
ORDER BY 2
ORA-01785:ORDER BY ITEM MUST BE THE NUMBER OF A SELECT-LIST EXPRESSION

--隨機排序union
select level L from dual connect by level<10
UNION
SELECT L
FROM (select level L from dual connect by level<10)
ORDER BY DBMS_RANDOM.VALUE

--ORA=03113:通訊通道的檔案結尾 程式ID:0 會話ID: 130 序列號:465

--此時客戶端失去會話連線,需要重新連線

--一般排序union
select level L from dual connect by level<10
UNION
SELECT L
FROM (select level L from dual connect by level<10)
ORDER BY 1

--正常

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25323853/viewspace-714781/,如需轉載,請註明出處,否則將追究法律責任。

相關文章