Вы можете сгенерировать значения DATE с помощью CONNECT BY и использовать сгенерированные значения в CROSS JOIN. (Хотя ответ уже есть, возможно, следующий пример немного легче понять.)
Таблица, содержащая уникальные идентификаторы
create table file_r (
id number unique
) ;
insert into file_r( id )
select 100 from dual union all
select 202 from dual union all
select 555 from dual ;
CTAS ( создать таблицу как select)
-- You can create the temporary table "on the fly"
create table temptbl( tid, tdate )
as
select id, dt
from (
( select id from file_r ) -- unique IDs
cross join
(
select
to_date( '2020-06-01 17:00','YYYY-MM-DD HH24:MI' ) -- start date/time
+ ( level - 1 ) dt
from dual
connect by level <= 3 -- amount of days needed
) -- generated DATEs
) ;
-- datatypes of the TEMPTBL
describe temptbl
Name Null? Type
________ ________ _________
TID NUMBER
TDATE DATE
Query (временная таблица)
select tid
, to_char( tdate, 'YYYY-MM-DD HH24:MI:SS' )
from temptbl
order by 1, 2
;
TID TO_CHAR(TDATE,'YYYY-MM-DDHH24:MI:SS')
______ ________________________________________
100 2020-06-01 17:00:00
100 2020-06-02 17:00:00
100 2020-06-03 17:00:00
202 2020-06-01 17:00:00
202 2020-06-02 17:00:00
202 2020-06-03 17:00:00
555 2020-06-01 17:00:00
555 2020-06-02 17:00:00
555 2020-06-03 17:00:00
Конечно, вы можете создать TEMPTBL, написав некоторый DDL code, а затем ВСТАВИТЬ В TEMPTBL (вместо CTAS):
-- alternative
create table temptbl(
tid number
, tdate date
, constraint id_date_unique unique( tid, tdate )
) ;
insert into temptbl( tid, tdate ) -- don't write VALUES ... here!
select id, dt
from (
( select id from file_r ) -- unique IDs
cross join
(
select
to_date( '2020-06-01 17:00','YYYY-MM-DD HH24:MI' )
+ ( level - 1 ) dt
from dual
connect by level <= 3
) -- generated DATEs
) ;
DBfiddle здесь .