我刚学存储过程, 下面这个存储过程有什么问题呢,
存储过程中“@”是什么意思呢?
create procedure p_chk
 (
 @n1 int,
 @n2 int,
 out @ifCanInsert int
 )
 select * from t;
 //提示错语
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 '@n1 i
nt,
@n2 int,
out @ifCanInsert int
)
select * from t' at line 3

解决方案 »

  1.   

    n1 integer,
    n2 integer,
    out ifCanInsert integer
      

  2.   

    @是自定义变量
    MySQL支持线程特定的变量,用@variablename句法。一个变量名可以由当前字符集的数字字母字符和“_”、“$”和“.”组成。缺省字符集是ISO-8859-1 Latin1;这可以通过重新编译MySQL改变。见9.1.1 用于数据和排序的字符集。 变量不必被初始化。缺省地,他们包含NULL并能存储整数、实数或一个字符串值。当线程退出时,对于一个线程的所有变量自动地被释放。 你可以用SET句法设置一个变量: SET @variable= { integer expression | real expression | string expression }
    [,@variable= ...].你也可以用@variable:=expr句法在一个表达式中设置一个变量: 
      

  3.   

    还不是很清楚,
    我怎么调用这个存储过程呢, 我用CALL(1,2,KK) 为什么不可以呢
      

  4.   

    @KK为什么是自定义变量, 而N1,N2不是呢?