我收到这些错误但不明白如何修复

时间:2016-10-21 18:45:46

标签: sql oracle

  • 错误(25,1):PLS-00103:遇到符号" EXEC"
  • 错误(30,1):PLS-00103:遇到符号" SELECT"当期望以下之一时:begin function pragma procedure子类型类型当前游标删除存在先前符号"开始"取代了#34; SELECT"接着说。
  • 错误(30,22):PLS-00103:遇到符号&#34;文件结束&#34;当期待下列之一:(开始情况声明结束异常退出goto如果循环mod空pragma提高返回选择更新,而&lt;&lt;继续关闭当前删除获取锁定插入打开回滚保存点设置sql执行提交forall合并管道清除< / LI>

DROP TABLE学生; COMMIT;

 CREATE TABLE Student(
    studentNumber INT NOT NULL,
    studentName VARCHAR2(20) NOT NUll,
    gender CHAR(1) NOT NULL,
    highSchoolAvg INT NOT NULL,
    scholarship INT DEFAULT 0,
    CONSTRAINT "student_gender" CHECK (gender IN ('M', 'F')),
    CONSTRAINT "student_highSchoolAvg" CHECK (highSchoolAvg BETWEEN 0 AND       100)
);

CREATE OR REPLACE PROCEDURE AcceptStudent(
    studentNumberPR INT,
    studentNamePR VARCHAR2,
    genderPR CHAR,  
    highSchoolAvgPR INT)
IS
    ScholarshipPr INT;
BEGIN
    ScholarshipPR := 0;

    IF highSchoolAvgPR >= 90 and highSchoolAvgPR <=100 THEN
        ScholarshipPR := 1500;

    ELSIF highSchoolAvgPR >= 85 and highSchoolAvgPR < 90 THEN
        ScholarshipPR := 1000;

    ELSE
       raise_application_error(-20201, 'Invalid highSchool average');
    END IF;

    INSERT INTO Student (studentNumber, studentName, gender,     highSchoolAvg, scholarship) 
        VALUES (studentNumberPR, studentNamePR, genderPR,     highSchoolAvgPR, ScholarshipPr);
END;

exec ACCEPTSTUDENT (1, 'Ashley', 'F', 87);
exec ACCEPTSTUDENT (2, 'Will', 'M', 76);
exec ACCEPTSTUDENT (3, 'David', 'M', 94);
--Holly should be the only error--
exec ACCEPTSTUDENT (4, 'Holly', 'F', 103);
select * from student;

1 个答案:

答案 0 :(得分:0)

您是否尝试从脚本执行所有操作?在程序之后,您在单独的一行中缺少斜杠/