定义表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;
答案错在哪里了?求改正
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;
答案错在哪里了?求改正
as
CURSOR c_job IS select * from student where sdept='CS';
c_row student%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;
close c_job;
end;
][/code]
Line: 12
Text: END c_job;Error: PLS-00103: 出现符号 "END"
Line: 13
Text: end;
close c_job;