PLS-00103错误 怎么解决呀!!!
杰克牌辣酱 2011-06-17 11:11:31 Error: PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
language
Line: 8
Text: begin
Error: PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following:
end not pragma final instantiable order overriding static
member constructor map
The symbol "static" was substituted for "PROCEDURE" to continue.
Line: 15
Text: PROCEDURE RemoveStudent (p_studentid in students.id%type,
Error: PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following:
end not pragma final instantiable order overriding static
member constructor map
The symbol "static" was substituted for "PROCEDURE" to continue.
Line: 34
Text: procedure ClassList(p_department in classes.department%type,
Error: PLS-00103: Encountered the symbol "CLASSPACKAGE" when expecting one of the following:
;
Line: 65
Text: end classpackage;
下面是程序代码
--包体 package body
CREATE OR REPLACE PACKAGE classpackage AS
/* is not essential
*/
--add a new student for the specified class.
PROCEDURE AddStudent (p_studentid in students.id%type,
p_department in classes.department%type,
p_course in classes.course%type) as
begin
insert into registered_students(student_id,department,course)
values(p_studentid,p_department,p_course);
commit;
end AddStudent;
-- removes the specified student from the specified class.
PROCEDURE RemoveStudent (p_studentid in students.id%type,
p_department in classes.department%type,
p_course in classes.course%type) IS
begin
delete from registered_students
where student_id = p_studentid
and department = p_department
and course = p_course;
-- check to see if the DELETE operation was successful.
-- If it didn't match any rows,raise an error.
if sql%notfound then
raise e_studentnotregistered;
end if;
commit;
end RemoveStudent;
-- Return a PL/SQL table containing the students currently
-- in the specified class.
procedure ClassList(p_department in classes.department%type,
p_course in classes.course%type,
p_ids out t_studentidtable,
p_numstudents in out binary_integer) IS
v_studentid registered_students.student_id%type;
-- Local cursor to fetch the registered students.
cursor c_RegisteredStudents is
select student_id
from registered_students
where department = p_department
and course = p_course;
begin
/* p_NumStudents will be the table index.It will start at
0,and be incremented each time through the fetch loop.
At the end of loop,it will have the number of rows
fetched, and therefore the number of rows returned in
p_IDs.
*/
p_numstudents := 0;
open c_RegisteredStudents;
loop
fetch c_RegisteredStudents into v_studentid;
exit when c_RegisteredStudents%notfound;
p_numstudents := p_numstudents+1;
p_ids(p_numstudents) := v_studentid;
end loop;
close c_RegisteredStudents;
end ClassList;
end classpackage;
--package header包头
-- Author : SUN
-- Created : 2011/6/15 20:51:57
-- Purpose :
-- note : package specification and package body are stored in the different dictionaries
CREATE OR REPLACE PACKAGE classpackage as
/*-- PROCEDURE and FUNCTION are all forward declarations,
即 procedure <ProcedureName>(<Parameter><Datatype>);
function <FunctionName>(<Parameter> <Datatype>) return <Datatype>;
*/
procedure addstudent (p_studentin in students.id%type,
p_department in classes.department%type,
p_course in classes.course%type);
procedure removestudent (p_studentid in students.id%type,
p_department in classes.department%type,
p_course in classes.course%type);
e_studentnotregistered exception;
type t_studentidtable is table of students.id%type
index by binary_integer;
procedure classlist (p_department in classes.department%type,
p_course in classes.course%type,
p_ids out t_studentidtable,
p_numstudents in out binary_integer);
end classpackage;