Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to insert rows Periodically ?

Status
Not open for further replies.

access97to2000

Programmer
Aug 12, 2002
45
US
Hi,
I would like to Periodically insert a row into a table "table1" which has 2 columns- Col1 and Col2 - EVERY SECOND - with data as follows :

Row1 Row 2
1 - 11:08:30 (Current Time stamp )
2 - 11:08:31 (Current Time stamp)
3 - 11:08:32 (Current Time Stamp)
....... continues every second

like that every second ( 1st column - an incrementing number, 2nd column - current time stamp)
How can i do this ?
Thanks
Rako
 

I am just curious why you need such insert? You can just do a common insert within a loop. Fine-tune your insert with a dealy algo equivalent to 1 second.

for i in 1..1000 loop

insert into table1
select i, to_char(sysdate,'HH24:MI:SS')
from dual;

-- put your delay algo here..
for j in 1..3 loop
null;
end loop;

end loop;
end loop;

Robbie

"The rule is, not to besiege walled cities if it can possibly be avoided" -- Art of War
 
Using loop for delay is quite unclean technique: you may use dbms_lock.sleep or dbms_utility.get_time to measure time intervalce more precisely. You may also use dbms_job to schedule your job, but its precision is measured in seconds. Though I also wonder why?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top