I want to write a query in oracle sql, which returns every minute of the current day in one column. But i've got no idea, how to start :-(
min
27.03.2014 00:00
27.03.2014 00:01
27.03.2014 00:02
...
27.03.2014 23:59
Thanks
We can use arithmetic to manipulate dates, and the simple CONNECT BY trick to generate a stream of rows.
alter session set nls_date_format='dd-mon-yyyy hh24:mi'
/
with cte as ( select trunc(sysdate) as start_date from dual )
select start_date + ((level-1)/(24*60)) as date_w_mins
from cte
connect by level <= (24*60)
/