Hi All,
Oracle version - 19c
I have below code and I need correction in that.
If I have a one record then I need to insert next 5 subsequent date wise records 0 quantity. My current solution is not giving me the correct quantity.
with t as (
select '111' id, to_date('22-MAY-23','DD-MON-YY') as startdate, 2.5 qty from dual
)
select t.id
,l.startdate
,t.qty
from t
cross join
lateral (select t.startdate+(level-1) as startdate
from dual
connect by level <= 5) l
;
My output should be as follows:
ID STARTDATE QTY
111 22-MAY-23 2.5
111 23-MAY-23 0
111 24-MAY-23 0
111 25-MAY-23 0
111 26-MAY-23 0
Regards,
Sid