create procedure ranking(selectID varchar(300))
begin
declare idCount int
declare strTemp varchar(10)
 set strTemp = selectID
     while strTemp is not NULL or strTemp = '' do
           set idCount = idCount + 1
           set strTemp = subString(selectID,1,instr(selectID,','))
     end while
     set selectID = subString(selectID,1,length(selectID)-1)
     SELECT * from matrice where id in (selectID);
     create temporary table tempRank(id varchar(10),tempScore double(10))
end
这个存储过程有什么问题吗??语法上?? 请高手指点,整了一天了,就是找不到原因。运行会出这个错:
#1064 - 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 'int
declare strTemp varchar(10)
set strTemp = selectID
     while strTemp is' at line 3 
如果只写个空的可以创建成功:
create procedure ranking(selectID varchar(300))
begin
end里面加一点东西都创建失败
create procedure ranking(selectID varchar(300))
begin
declare idCount int
declare strTemp varchar(10)
end
而且还不能alter procedure,。必须删了重来。

解决方案 »

  1.   

     BEGIN
    declare idCount int;
    declare strTemp varchar(10);
     set strTemp = selectID;
         while strTemp is not NULL or strTemp = '' do
               set idCount = idCount + 1;
               set strTemp = subString(selectID,1,instr(selectID,','));
         end while;
         set selectID = subString(selectID,1,length(selectID)-1);
         SELECT * from matrice where id in (selectID);
    create temporary table tempRank(id varchar(10),tempScore double);
         end
      

  2.   

    alter procedure 为什么会报错???????????????
    需要设置权限吗??怎么设置??
      

  3.   

    在什么环境下修改?命令行、SQLYOG?
      

  4.   

    加一句:
    DROP PROCEDURE IF EXISTS `db`.`ranking`
      

  5.   

    我不想删除,再创建,就想直接 用 alter procedure 去修改 存储过程
      

  6.   

    我不想删除,再创建,就想直接 用 alter procedure 去修改 存储过程
      

  7.   

    mysql的alter procedure 只能改头部那几项信息,不能改存储过程内容,只能drop了再create