create or replace procedure s_test as
CURSOR c_job IS select * from student where sdept='CS';
c_row c_job%rowtype;
begin
open c_job;
LOOP
FETCH c_job INTO c_row;
exit when c_job%notfound;
dbms_output.put_line(c_row.sno||'-'||c_row.sname||'-'||c_row.sdept);
INSERT INTO S2(sno,sname,sdept) VALUES(c_row.sno,c_row.sname,c_row.sdept);
END LOOP;
END c_job;
end;
答案错在哪里了?求改正 ------最佳解决方案--------------------
--既然表结构相同就不需要这样了
--可以这样做
insert into s2 select *from student where sdept='CS';
--存储过程都省略了。。