测试了很久,网上说的方法很多,其实都是错误的,正确的写法:
declare
cursor rowAll is select * from tb_news where 1=1;
row1 tb_news%rowtype;
i int;
begin
i := 0;
for row1 in rowAll
loop
row1.id := fn_gen_getid('tb_news');
row1.addtime := sysdate;
row1.starttime := sysdate;
row1.adduserid := -100;
insert into tb_news values row1;
commit;
end loop;
end;
误打误撞,乱写一通,没想到这样可以。不过我在查询窗口使用dbms_output.put_line(sysdate); 怎么都报错,崩溃!by default7#zbphp.com