oracle中用PL/SQL游标插入数据的例子?

来源:百度知道 编辑:UC知道 时间:2024/06/23 17:46:35
有谁写帮忙一个用游标循环插入数据的例子.!
谢谢.

declare
cursor cur_1 is select sysdate from dual;
begin
for rec_1 in cur_1 loop
insert into table values (rec_1.sysdate);
commit;

end loop;
exception
when others then
rollback;

end;

随便写了一个

create table temp1 as
select distinct
dept_no
from dept;

CREATE TABLE tmp_art(
dept_no number(2) ,
art_no NUMBER(7) ,
descr VARCHAR2(33) ,
sold_qty NUMBER(18,2) ,
sold_amnt NUMBER(18,2) )
STORAGE ( INITIAL 300 K
NEXT 100 K