我的存储过程
CREATE PROCEDURE v_competition_getlabels(f1 varchar(20))
begin
if(f1='voc_id') then
select distinct voc_id,rps_voc from viw_competition_ana;
else if(f1='cop_id') then
select distinct cop_id,cop_name from viw_competition_ana;
end if;
end if;
end;
Error Code : 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 '' at line4
我在mysql-front 5.1下能执行,可到了phpmyadmin sqlyog工具里就不可以执行,谁能告诉我这个存储过程错在哪里了,谢谢!
CREATE PROCEDURE v_competition_getlabels(f1 varchar(20))
begin
if(f1='voc_id') then
select distinct voc_id,rps_voc from viw_competition_ana;
else if(f1='cop_id') then
select distinct cop_id,cop_name from viw_competition_ana;
end if;
end if;
end;
Error Code : 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 '' at line4
我在mysql-front 5.1下能执行,可到了phpmyadmin sqlyog工具里就不可以执行,谁能告诉我这个存储过程错在哪里了,谢谢!
mysql> delimiter //
mysql> CREATE PROCEDURE v_competition_getlabels(f1 varchar(20))
-> begin
-> if(f1='voc_id') then
-> select distinct voc_id,rps_voc from viw_competition_ana;
-> else if(f1='cop_id') then
-> select distinct cop_id,cop_name from viw_competition_ana;
-> end if;
-> end if;
-> end;
-> //
Query OK, 0 rows affected (0.45 sec)mysql> delimiter ;
mysql>