有mysql基础,但是第一次写存储过程
参看了网上例程,
直接拷贝进test_proc.sql文件
内容如下
 create procedure pr_add
 (
     a int,
     b int
 )
 begin
     declare c int;
 end;
然后在linux mysql命令行里面source test_proc.sql 就报错。然后将文件代码修改为
create procedure pr_add
 (
     a int,
     b int
 )
 begin
 end;
就没有报错。只要begin和end之间有任何语句都报错。

解决方案 »

  1.   

    delimiter $$
    create procedure pr_add
     (
         a int,
         b int
     )
     begin
         declare c int;
     end$$
    delimiter ;
      

  2.   

    报错如下:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'end' at line 1