- declare
- --声明游标拿取外键modid
- cursor cur_type is
- select modid from modules where modid > 0;
- begin
- --循环100000条数据
- for rn in 1 .. 100000 loop
- --申明游标变量r
- for r in cur_type loop
- --插入数据
- insert into notes
- (noteid,
- modid,
- userid,
- notetitle,
- notedate,
- notectx,
- subnote,
- notestatu,
- notesay,
- istop,
- iselite)
- values
- (seq_noteid.nextval,
- r.modid,
- trunc(dbms_random.value(2, 1000)),
- '呵呵,我是灌水帖',
- sysdate,
- '灌水不要内容',
- 0,
- 1,
- 'ff',
- 0,
- 0);
- end loop;
- commit;
- end loop;
- end;
- --该片段来自于http://www.codesnippet.cn/detail/1206201614716.html
来源: http://www.codesnippet.cn/detail/1206201614716.html