日期:2014-05-17  浏览次数:20848 次

急,求解答
定义表S2,表结构同student表相同.编写存储过程,在过程中利用游标将student表中系别为'CS'的记录插入到表S2中

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;
 答案错在哪里了?求改正 
 
 


------解决方案--------------------
select出来的数据是多条的 fetch只能取出一条
------解决方案--------------------
关闭游标
close c_job;