Farzad Soltani Farzad Soltani - 2 months ago 8
SQL Question

SQL List of Values 00:00 to 24:00

I'm creating a select list based on a SQL Query in my Oracle APEX page.

I want it to show these time values :

00:00
00:01
00:02
.
..
...
.
.
23:59


How can this be achieved?

Answer

Use CONNECT BY for Oracle 10+

SELECT TO_CHAR(TRUNC(SYSDATE) + (LEVEL-1)/24/60, 'HH24:MI')
  FROM DUAL
CONNECT BY LEVEL <= 24*60
Comments