How to generate timeseries data into table in Oracle PL/SQL between two date using interval 1 minute?

Multi tool use
Multi tool use

The name of the picture


How to generate timeseries data into table in Oracle PL/SQL between two date using interval 1 minute?



I am new in this topic. In my setup Oracle 12c Standart Edition database and PL/SQL Developer.
I have a table which has the following structure:


int id;
timestamp time_mon;
double price;



I need to insert data into a table which generate with some period such as 02.01.2018 00:00 - 02.01.2019 00:00 with an interval of 5 minutes. I cannot cope with this task. Please help me and show the SQL code example.




1 Answer
1



Assuming you mean 02.01.2018 = 2 January, this could be a way:


select date '2018-01-02' + interval '5' minute * (level -1)
from dual
connect by date '2018-01-02' + interval '5' minute * (level -1) <= date '2019-01-02'






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

aQkziXkDfbItqysxi,4WOF9XNz4zg6miL
DJ,RiGhzDeCBCmSD 0

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty