Home > database >  Oracle stored procedure compilation warnings, help to see where is wrong?
Oracle stored procedure compilation warnings, help to see where is wrong?

Time:09-28

The create or replace procedure ADMIN. P_selectCourse (
P_teachId in number,
P_courseNumber in varchar2 (20),
P_studentNumber in varchar2 (18),
P_error out number)
Is
I the INTEGER;
The begin
The select studentMaxNumber into the I from publicCourseTeach where teachId=p_teachId;
The SAVEPOINT p1.
If i> 0 then
The update publicCourseTeach set studentMaxNumber=studentMaxNumber - 1 where teachId=p_teachId;
Insert into studentSelectCourseInfo (studentNumber courseNumber) values (p_studentNumber p_courseNumber);
Commit;
If sqlcode==0 then
P_error:=1;
Dbms_output. Put_line (p_error);
The else
The rollback to p1;
P_error:=0;
Dbms_output. Put_line (p_error);
end if;
The else
P_error:=1;
Dbms_output. Put_line (p_error);
end if;
The end;

CodePudding user response:

Back to the savepoint, must be before did not commit, commit, it doesn't make any sense to save the point

CodePudding user response:

Ensure studentMaxNumber only one value is returned
If the same as=

CodePudding user response:

Changed or not

CodePudding user response:

If sqlcode==0 then

It is ok to write an equal sign,

CodePudding user response:

P_courseNumber in varchar2 (20),
P_studentNumber in varchar2 (18),

Parameters, only write type, don't write the length,

CodePudding user response:

The point is I have commented out in the middle of the, only pass the left frame,,,,

CodePudding user response:

Of course not only frame, begin the end, at least one statement,

If there is no need to write, to write such a

The begin
null;
end

CodePudding user response:

Call the stored in to commit,
  • Related