程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> select-用MySql的Navicat創建存儲過程總是報1458錯誤

select-用MySql的Navicat創建存儲過程總是報1458錯誤

編輯:編程綜合問答
用MySql的Navicat創建存儲過程總是報1458錯誤

下面是我穿件存儲過程的代碼。求大神幫忙看看。真心很急,明天就要用。

 create procedure searchStudentGrade(in id char)
 begin
     if id is null
         select  student.StudentID,student.StudentName,student.ClassNumber,grade.ExamID,course.CourseName,grade.Grade,course.CourseID
        from student,grade,course
        where student.StudentID=grade.StudentID and grade.CourseID=course.CourseID;
    else
        select student.StudentID,student.StudentName,student.ClassNumber,grade.ExamID,course.CourseName,grade.Grade,course.CourseID
        from student,grade,course
        where student.StudentID=grade.StudentID and grade.CourseID=course.CourseID and grade.StudentID=id;
    end if;
end;

最佳回答:


 create procedure searchStudentGrade(in id char)
 begin
     if id is null then 這裡少了一個then吧
         select  student.StudentID,student.StudentName,student.ClassNumber,grade.ExamID,course.CourseName,grade.Grade,course.CourseID
        from student,grade,course
        where student.StudentID=grade.StudentID and grade.CourseID=course.CourseID;
    else
        select student.StudentID,student.StudentName,student.ClassNumber,grade.ExamID,course.CourseName,grade.Grade,course.CourseID
        from student,grade,course
        where student.StudentID=grade.StudentID and grade.CourseID=course.CourseID and grade.StudentID=id;
    end if;
end;
tianzhaoai
tianzhaoai
tianzhaoai
tianzhaoai
tianzhaoai
danielinbiti
tianzhaoai
tianzhaoai
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved