tianzhaoai
xyTianZhao
采纳率66.7%
2015-06-17 16:47 浏览 2.9k

用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;
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答 默认 最新

  • 已采纳
    danielinbiti danielinbiti 2015-06-17 17:06
     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;
    
    点赞 评论 复制链接分享
  • ycg514230 帘卷西风 2015-06-18 00:20

    还有那里不对?报什么错?

    点赞 评论 复制链接分享

相关推荐