Procedure or function for insert into select ...
Hi!
We need to know if we can create a procedure or function that will run the following script:
-------------------------------------------------------------------------------------------------
insert into agent.train_schedule
select 4000, '06:25' ,trunc(sysdate, 'year')+t.n
from agent.trains, (select rownum -1 n from dual
connect by level <= 365) t
where agent.trains.id = 4000 and
agent.trains.weekday like '%'||to_char(trunc(sysdate, 'year')+t.n, 'd',
'nls_date_language=AMERICAN')||'%';
--------------------------------------------------------------------------------------------------
The script inserts the train schedule dates into the train schedule table in accordance to the trains table.
Any help would be appreciated.
Thanks!