给pub.test8_insert插入一行数据,立刻循环等待数据库后台系统给pub.test8_select插入数据,后台系统每5秒钟定时执行一次,会在1秒钟之内分组形成500个随机数(每组数据行数不固定,但是不会超过10行),且形成下一组数据的之前,自动删除上一租数据,客户端程序的就是要及时读取pub.test8_select中的数据,然后将读取到的数据写入pub.test8_update中。
要求用动态SQL来写,我这里就是不会该怎么在500个数据都产生完再去插。下面代码只是插入之后马上去查询pub.test8_select中的数据,结果这样什么也没查到
能不能有什么时间函数, 循环等待1分钟再去插入。
declare
type ref_type is ref cursor;
v_cursor ref_type;
v_record pub.test8_select%rowtype;
sqlstring varchar2(200);
begin
sqlstring:='select * from pub.test8_select';
insert into pub.test8_insert values('2010003010xx','XXX');
open v_cursor for sqlstring;
loop
fetch v_cursor into v_record;
update pub.test8_update a set a.随机数=v_record.随机数 where a.学号=v_record.学号 and a.序号=v_record.序号;
exit when v_cursor%notfound;
end loop;
close v_cursor;
end;