0
如果课堂容量不满,我需要为学生注册课程。PL/SQL将学生录入课堂
学生:
SNUM SNAME
**** ****
102 Bob
103 Lee
104 Ali
课程:
DEPT CNUM
**** ****
FIN 300
FIN 330
FIN 400
ClassSchedule:
ClassNum Instructor Capacity
******** ********** *******
10510 Larry 3
10210 Bob 5
10401 Sally 10
入学人数:
SNUM ClassNum
**** ********
102 10510
103 10510
104 10401
我的伪代码:
CREATE OR REPLACE Procedure AddStudent(
p_snum students.SNUM%type
p_ClassNum SchClasses.ClassNum%Type)
AS
p_Capacity_SchClasses number;
BEGIN
SELECT Count(*) into p_Capacity_ClassSchedue
FROM SchClasses cs
JOIN Enrollments e ON cs.ClassNum = e.ClassNum
GROUP BY sc.CallNum
IF count(p_ClassNum) <= p_Capacity_SchClasses THEN
insert into E values(p_SNUM, p_ClassNum, null);
dbms_output.put.line('Congrats, you are now enrolled.');
ELSE
dbms_output.put.line('Sorry, this class is full.');
END IF;
END;
/
我怎么会做出p_snum和p_classnum数为1级的学生吗?
感谢您回复!现在它变得更有意义。但是,我收到这样的错误:第19行和第21行的“语句忽略”和“子程序或光标'PUT'引用超出了范围'。 – Lizzie
@Lizzie - 将'put.line'更改为'put_line'它现在应该工作 –
哇,我很傻,谢谢!这让我明白了很多。 – Lizzie