子程序od游标'ADD_student'在包规范中声明,必须在包体

时间:2016-05-21 16:15:06

标签: sql plsql oracle11g

子程序od游标'ADD_student'在包规范中声明,必须在包体中定义。我检查了一下,我不知道发生了什么。

包裹声明:

create or replace PACKAGE students_package AS 
PROCEDURE add_student(s_name STUDENTS.STUDENT_NAME%type, 
s_surname STUDENTS.SURNAME%type, 
s_pesel STUDENTS.pesel%type, 
s_date STUDENTS.DATE_OF_BIRTH%type, 
s_place STUDENTS.PLACE_OF_BIRTH%type, 
s_behaviour STUDENTS.BEHAVIOR%type, 
s_disease STUDENTS.TYPE_OF_DISEASE%type); 
procedure delete_student(s_id students.student_id%type); 
procedure edit_student(s_id STUDENTS.STUDENT_ID%type, 
s_name STUDENTS.STUDENT_NAME%type, 
s_surname STUDENTS.SURNAME%type, 
s_pesel STUDENTS.pesel%type, 
s_date STUDENTS.DATE_OF_BIRTH%type, 
s_place STUDENTS.PLACE_OF_BIRTH%type, 
s_behavior STUDENTS.BEHAVIOR%type, 
s_disease STUDENTS.TYPE_OF_DISEASE%type); 
END students_PACKAGE;

体:

create or replace PACKAGE BODY students_package AS 
PROCEDURE add_student(s_name  STUDENTS.STUDENT_NAME%type, 
s_surname  STUDENTS.SURNAME%type, 
s_pesel  STUDENTS.pesel%type, 
s_date  STUDENTS.DATE_OF_BIRTH%type, 
s_place  STUDENTS.PLACE_OF_BIRTH%type, 
s_behavior  STUDENTS.BEHAVIOR%type, 
s_disease  STUDENTS.TYPE_OF_DISEASE%type)  IS 
BEGIN INSERT INTO     students(STUDENT_NAME,SURNAME,PESEL,DATE_OF_BIRTH,PLACE_OF_BIRTH,BEHAVIOR,TYPE_OF_DISEASE) 
VALUES (s_name ,s_surname ,s_pesel ,s_date ,s_place ,s_behavior ,s_disease); 
end add_student; 
procedure edit_student(s_id STUDENTS.STUDENT_ID%type,
s_name STUDENTS.STUDENT_NAME%type, 
s_surname STUDENTS.SURNAME%type, 
s_pesel STUDENTS.PESEL%type, 
s_date STUDENTS.DATE_OF_BIRTH%type, 
s_place STUDENTS.PLACE_OF_BIRTH%type, 
s_behavior STUDENTS.BEHAVIOR%type, 
s_disease STUDENTS.TYPE_OF_DISEASE%type)is 
BEGIN update students 
set students.STUDENT_NAME=s_name,students.SURNAME=s_surname,students.PESEL=s_pesel, 
students.DATE_OF_BIRTH=s_date,students.PLACE_OF_BIRTH=s_place, 
students.BEHAVIOR=s_behavior,students.TYPE_OF_DISEASE=s_disease 
where students.STUDENT_ID = s_id; 
end edit_student; 
procedure delete_student(s_id STUDENTS.STUDENT_ID%type) is 
begin update students 
set students.STUDENT_ID=null,students.SURNAME=null,students.PESEL=null, students.DATE_OF_BIRTH=null,
students.PLACE_OF_BIRTH=null, students.BEHAVIOR=null,students.TYPE_OF_DISEASE=null 
where students.STUDENT_ID = s_id; 
end delete_student; 
END students_package;

我不知道出了什么问题。

我也有一个触发器:

create or replace TRIGGER "STUDENTS_TRIGGER" 
    before insert on 
    STUDENTS 
    for each row begin :new.student_id := students_auto_incr.nextval; 
    end;

和顺序:

CREATE SEQUENCE  "KONRAD"."STUDENTS_AUTO_INCR"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;

1 个答案:

答案 0 :(得分:1)

参数s_behaviour在规范和包中拼写不同:

s_behaviour STUDENTS.BEHAVIOR%type, 

VS

s_behavior STUDENTS.BEHAVIOR%type,