CodePudding user response:
The order by case when col1 & gt; To_char (sysdate, 'hh24) then 0 else 1 end, col1CodePudding user response:
FROM the SELECT S (SELECT TO_DATE (' 20200101 ', 'YYYYMMDD') + (LEVEL 1)/24 S FROM DUAL CONNECT BY LEVEL & lt; T=24)The ORDER BY CASE WHEN TO_CHAR (S, 'HH24) & gt;=TO_CHAR (SYSDATE, 'HH24) THEN one ELSE 2 END, TO_CHAR (S,' HH24 ');