Reputation: 15
I want to add time series to my database table autogenerated. Suppose the column values should be
How do I do this in Oracle db?
Upvotes: 1
Views: 60
Reputation: 4129
You can generate data like this recursively using hierarchical query
select to_date('23-07-2021 00:00:00', 'dd-mm-yyyy hh24:mi:ss') + level / 24 / 60 * 5
from dual
connect by level <= 1000
Where
UPD. Additional reuirement from OP: "This just creates a temporary table. I wanted to insert these values to a new table. And the value should just be till current_date + 1"
create table ek_test as
select to_date('23-07-2021 00:00:00', 'dd-mm-yyyy hh24:mi:ss') + level / 24 / 60 * 5 date_col
from dual
connect by to_date('23-07-2021 00:00:00', 'dd-mm-yyyy hh24:mi:ss') + level / 24 / 60 * 5 < sysdate + 1
Upvotes: 2