Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Procedure or function for insert into select ...

user545194Nov 20 2007 — edited Nov 20 2007
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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 18 2007
Added on Nov 20 2007
7 comments
354 views