qq_36457702
走路带疯的人zzZ
2017-10-15 05:14

编写“显示指定教师信息”的匿名块。

  • cursor
  • select

declare
v_teacherID teacher.teacher_id%TYPE:='&要查询的教师编号';
ex_insert EXCEPTION;
CURSOR c1(v_teacherID VARCHAR2) IS
SELECT * FROM TEACHER WHERE Teacher_ID=v_teacherID;
TEACHER_rec TEACHER%ROWTYPE;
BEGIN
IF v_teacherID="123" THEN
RAISE ex_insert;
ELSE
OPEN c1(v_teacherID);
LOOP
FETCH c1 INTO TEACHER_rec;
dbms_output.put_line('教师编号:'||TEACHER_rec.Teacher_ID||'姓名:'||TEACHER_rec.Tname||'性别:'||TEACHER_rec.Tsex||'出生日期:'||TEACHER_rec.Tbirth||'学历:'||TEACHER_rec.Educ||'职称:'||TEACHER_rec.Profess||'系部代码:'||TEACHER_rec.Dept_ID);
END LOOP;
END IF;
CLOSE c1;
EXCEPTION
WHEN ex_insert THEN
dbms_output.put_line('教师编号不能为空!');
end;
我这代码错误很多求大神帮我看下,该怎么修改。

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答