I have the following code, which I use to generate test data and it works okay.
Is there a way I can wrap this to create a PIPELINED function that accepts a from and to date instead of hard coding UNION ALL for each date I need data for?
For example, let's say I want to create a N NUMBER of rows of data for each day from date'2022-08-01' - date'2022-08-31' where the DEFAULT for N=100. If possible, could there be only one generic solution that handles both dates and timestamps?
I'm certainly open to any alternative ways to achieve this goal if a PIPELINED function isn't the best way to proceed.
Thanks in advance to all who answer and your expertise. Below is what I'm using now.
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'
select * from (
select date'2022-08-01'
+ numtodsinterval ( level , 'minute' )
+ dbms_random. value datetime
from dual
connect by level <= 100
union all
select date'2022-08-02'
+ numtodsinterval ( level , 'minute' )
+ dbms_random.value datetime
from dual
connect by level <= 100
)